File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
webview-ui/src/components/ui/hooks Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -616,7 +616,7 @@ describe("useSelectedModel", () => {
616616 expect ( result . current . info ?. supportsNativeTools ) . toBe ( true )
617617 } )
618618
619- it ( "should use model info from routerModels when model exists" , ( ) => {
619+ it ( "should merge only native tool defaults with routerModels when model exists" , ( ) => {
620620 const customModelInfo : ModelInfo = {
621621 maxTokens : 16384 ,
622622 contextWindow : 128000 ,
@@ -650,9 +650,15 @@ describe("useSelectedModel", () => {
650650
651651 expect ( result . current . provider ) . toBe ( "litellm" )
652652 expect ( result . current . id ) . toBe ( "custom-model" )
653- // Should use the model info from routerModels, not the fallback
654- expect ( result . current . info ) . toEqual ( customModelInfo )
653+ // Should only merge native tool defaults, not prices or other model-specific info
654+ // Router model values override the defaults
655+ const nativeToolDefaults = {
656+ supportsNativeTools : litellmDefaultModelInfo . supportsNativeTools ,
657+ defaultToolProtocol : litellmDefaultModelInfo . defaultToolProtocol ,
658+ }
659+ expect ( result . current . info ) . toEqual ( { ...nativeToolDefaults , ...customModelInfo } )
655660 expect ( result . current . info ?. supportsNativeTools ) . toBe ( true )
661+ expect ( result . current . info ?. defaultToolProtocol ) . toBe ( "native" )
656662 } )
657663 } )
658664} )
Original file line number Diff line number Diff line change @@ -166,7 +166,13 @@ function getSelectedModel({
166166 }
167167 case "litellm" : {
168168 const id = getValidatedModelId ( apiConfiguration . litellmModelId , routerModels . litellm , defaultModelId )
169- const info = routerModels . litellm ?. [ id ] ?? litellmDefaultModelInfo
169+ const routerInfo = routerModels . litellm ?. [ id ]
170+ // Only merge native tool call defaults, not prices or other model-specific info
171+ const nativeToolDefaults = {
172+ supportsNativeTools : litellmDefaultModelInfo . supportsNativeTools ,
173+ defaultToolProtocol : litellmDefaultModelInfo . defaultToolProtocol ,
174+ }
175+ const info = routerInfo ? { ...nativeToolDefaults , ...routerInfo } : litellmDefaultModelInfo
170176 return { id, info }
171177 }
172178 case "xai" : {
You can’t perform that action at this time.
0 commit comments