@@ -682,59 +682,44 @@ export class Core {
682
682
}
683
683
} ) ;
684
684
685
- on (
686
- "tools/call" ,
687
- async ( { data : { toolCall, selectedModelTitle } , messageId } ) => {
688
- const { config } = await this . configHandler . loadConfig ( ) ;
689
- if ( ! config ) {
690
- throw new Error ( "Config not loaded" ) ;
691
- }
692
-
693
- const tool = config . tools . find (
694
- ( t ) => t . function . name === toolCall . function . name ,
695
- ) ;
696
-
697
- if ( ! tool ) {
698
- throw new Error ( `Tool ${ toolCall . function . name } not found` ) ;
699
- }
685
+ on ( "tools/call" , async ( { data : { toolCall } } ) => {
686
+ const { config } = await this . configHandler . loadConfig ( ) ;
687
+ if ( ! config ) {
688
+ throw new Error ( "Config not loaded" ) ;
689
+ }
700
690
701
- if ( ! config . selectedModelByRole . chat ) {
702
- throw new Error ( "No chat model selected" ) ;
703
- }
691
+ const tool = config . tools . find (
692
+ ( t ) => t . function . name === toolCall . function . name ,
693
+ ) ;
704
694
705
- // Define a callback for streaming output updates
706
- const onPartialOutput = ( params : {
707
- toolCallId : string ;
708
- contextItems : ContextItem [ ] ;
709
- } ) => {
710
- this . messenger . send ( "toolCallPartialOutput" , params ) ;
711
- } ;
695
+ if ( ! tool ) {
696
+ throw new Error ( `Tool ${ toolCall . function . name } not found` ) ;
697
+ }
712
698
713
- const contextItems = await callTool (
714
- tool ,
715
- JSON . parse ( toolCall . function . arguments || "{}" ) ,
716
- {
717
- ide : this . ide ,
718
- llm : config . selectedModelByRole . chat ,
719
- fetch : ( url , init ) =>
720
- fetchwithRequestOptions ( url , init , config . requestOptions ) ,
721
- tool,
722
- toolCallId : toolCall . id ,
723
- onPartialOutput,
724
- } ,
725
- ) ;
699
+ if ( ! config . selectedModelByRole . chat ) {
700
+ throw new Error ( "No chat model selected" ) ;
701
+ }
726
702
727
- if ( tool . faviconUrl ) {
728
- contextItems . forEach ( ( item ) => {
729
- item . icon = tool . faviconUrl ;
730
- } ) ;
731
- }
703
+ // Define a callback for streaming output updates
704
+ const onPartialOutput = ( params : {
705
+ toolCallId : string ;
706
+ contextItems : ContextItem [ ] ;
707
+ } ) => {
708
+ this . messenger . send ( "toolCallPartialOutput" , params ) ;
709
+ } ;
732
710
733
- return { contextItems } ;
734
- } ,
735
- ) ;
711
+ return await callTool ( tool , toolCall . function . arguments , {
712
+ ide : this . ide ,
713
+ llm : config . selectedModelByRole . chat ,
714
+ fetch : ( url , init ) =>
715
+ fetchwithRequestOptions ( url , init , config . requestOptions ) ,
716
+ tool,
717
+ toolCallId : toolCall . id ,
718
+ onPartialOutput,
719
+ } ) ;
720
+ } ) ;
736
721
737
- on ( "isItemTooBig" , async ( { data : { item, selectedModelTitle } } ) => {
722
+ on ( "isItemTooBig" , async ( { data : { item } } ) => {
738
723
return this . isItemTooBig ( item ) ;
739
724
} ) ;
740
725
@@ -932,7 +917,6 @@ export class Core {
932
917
query : string ;
933
918
fullInput : string ;
934
919
selectedCode : RangeInFile [ ] ;
935
- selectedModelTitle : string ;
936
920
} > ,
937
921
) => {
938
922
const { config } = await this . configHandler . loadConfig ( ) ;
0 commit comments