Skip to content

Commit c816c85

Browse files
committed
fix(webview): address canonical provider review
1 parent f2bda6e commit c816c85

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ describe("useSelectedModel", () => {
455455

456456
expect(result.current.id).toBe("claude-opus-4-6")
457457
expect(result.current.info?.contextWindow).toBe(1_000_000)
458+
expect(result.current.info?.inputPrice).toBe(10.0)
459+
expect(result.current.info?.outputPrice).toBe(37.5)
458460
})
459461

460462
it.each(["anthropic", "gemini-cli", "fake-ai"] as const)(

webview-ui/src/components/ui/hooks/useSelectedModel.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,5 +461,9 @@ function getSelectedModel({
461461

462462
return { id, info: baseInfo }
463463
}
464+
default: {
465+
provider satisfies never
466+
throw new Error(`Unsupported provider: ${provider}`)
467+
}
464468
}
465469
}

webview-ui/src/utils/validate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function validateProviderAgainstOrganizationSettings(
207207
}
208208

209209
function getModelIdForProvider(apiConfiguration: ProviderSettings, provider: ProviderName): string | undefined {
210-
if (provider === "vscode-lm") {
210+
if (provider === providerIdentifiers.vscodeLm) {
211211
return apiConfiguration.vsCodeLmModelSelector?.id
212212
}
213213

@@ -318,7 +318,7 @@ export function validateApiConfigurationExcludingModelErrors(
318318
_routerModels?: RouterModels, // Keeping this for compatibility with the old function.
319319
organizationAllowList?: OrganizationAllowList,
320320
): string | undefined {
321-
if (apiConfiguration.apiProvider !== "zoo-gateway") {
321+
if (apiConfiguration.apiProvider !== providerIdentifiers.zooGateway) {
322322
const keysAndIdsPresentErrorMessage = validateModelsAndKeysProvided(apiConfiguration)
323323

324324
if (keysAndIdsPresentErrorMessage) {

0 commit comments

Comments
 (0)