File tree Expand file tree Collapse file tree
webview-ui/src/components/ui/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import type { Mock } from "vitest"
88import {
99 ProviderSettings ,
1010 ModelInfo ,
11+ anthropicModels ,
1112 BEDROCK_1M_CONTEXT_MODEL_IDS ,
1213 litellmDefaultModelInfo ,
1314 kenariDefaultModelId ,
@@ -440,6 +441,23 @@ describe("useSelectedModel", () => {
440441 expect ( result . current . info ?. inputPrice ) . toBe ( 6.0 )
441442 expect ( result . current . info ?. outputPrice ) . toBe ( 22.5 )
442443 } )
444+
445+ it . each ( [ "anthropic" , "gemini-cli" , "fake-ai" ] as const ) (
446+ "should explicitly resolve configured models for %s" ,
447+ ( apiProvider ) => {
448+ const apiConfiguration : ProviderSettings = {
449+ apiProvider,
450+ apiModelId : "claude-sonnet-4-6" ,
451+ }
452+
453+ const wrapper = createWrapper ( )
454+ const { result } = renderHook ( ( ) => useSelectedModel ( apiConfiguration ) , { wrapper } )
455+
456+ expect ( result . current . provider ) . toBe ( apiProvider )
457+ expect ( result . current . id ) . toBe ( "claude-sonnet-4-6" )
458+ expect ( result . current . info ) . toEqual ( anthropicModels [ "claude-sonnet-4-6" ] )
459+ } ,
460+ )
443461 } )
444462
445463 describe ( "bedrock provider with 1M context" , ( ) => {
Original file line number Diff line number Diff line change @@ -418,10 +418,9 @@ function getSelectedModel({
418418 const info = routerModels [ "zoo-gateway" ] ?. [ id ]
419419 return { id, info }
420420 }
421- // case providerIdentifiers.anthropic:
422- // case providerIdentifiers.fakeAi:
423- default : {
424- provider satisfies "anthropic" | "gemini-cli" | "fake-ai"
421+ case providerIdentifiers . anthropic :
422+ case providerIdentifiers . geminiCli :
423+ case providerIdentifiers . fakeAi : {
425424 const id = apiConfiguration . apiModelId ?? defaultModelId
426425 const baseInfo = anthropicModels [ id as keyof typeof anthropicModels ]
427426
@@ -462,5 +461,9 @@ function getSelectedModel({
462461
463462 return { id, info : baseInfo }
464463 }
464+ default : {
465+ provider satisfies never
466+ throw new Error ( `Unsupported provider: ${ provider } ` )
467+ }
465468 }
466469}
You can’t perform that action at this time.
0 commit comments