diff --git a/src/api/providers/ollama.ts b/src/api/providers/ollama.ts index f2134bb..7668bd3 100644 --- a/src/api/providers/ollama.ts +++ b/src/api/providers/ollama.ts @@ -42,7 +42,7 @@ export class OllamaHandler implements ApiHandler { getModel(): { id: string; info: ModelInfo } { return { - id: this.options.ollamaModelId ?? "", + id: this.options.ollamaModelId || "", info: openAiModelInfoSaneDefaults, } } diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index 1d746e2..e708fbc 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -724,19 +724,19 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) { case "openrouter": return { selectedProvider: provider, - selectedModelId: apiConfiguration?.openRouterModelId ?? openRouterDefaultModelId, - selectedModelInfo: apiConfiguration?.openRouterModelInfo ?? openRouterDefaultModelInfo, + selectedModelId: apiConfiguration?.openRouterModelId || openRouterDefaultModelId, + selectedModelInfo: apiConfiguration?.openRouterModelInfo || openRouterDefaultModelInfo, } case "openai": return { selectedProvider: provider, - selectedModelId: apiConfiguration?.openAiModelId ?? "", + selectedModelId: apiConfiguration?.openAiModelId || "", selectedModelInfo: openAiModelInfoSaneDefaults, } case "ollama": return { selectedProvider: provider, - selectedModelId: apiConfiguration?.ollamaModelId ?? "", + selectedModelId: apiConfiguration?.ollamaModelId || "", selectedModelInfo: openAiModelInfoSaneDefaults, } default: diff --git a/webview-ui/src/utils/validate.ts b/webview-ui/src/utils/validate.ts index dd3ec58..060e0f6 100644 --- a/webview-ui/src/utils/validate.ts +++ b/webview-ui/src/utils/validate.ts @@ -59,7 +59,7 @@ export function validateModelId( if (apiConfiguration) { switch (apiConfiguration.apiProvider) { case "openrouter": - const modelId = apiConfiguration.openRouterModelId ?? openRouterDefaultModelId // in case the user hasn't changed the model id, it will be undefined by default + const modelId = apiConfiguration.openRouterModelId || openRouterDefaultModelId // in case the user hasn't changed the model id, it will be undefined by default if (!modelId) { return "You must provide a model ID." }