File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -690,7 +690,7 @@ export namespace SessionPrompt {
690690 abort : options . abortSignal ! ,
691691 messageID : input . processor . message . id ,
692692 callID : options . toolCallId ,
693- extra : input . model ,
693+ extra : { model : input . model } ,
694694 agent : input . agent . name ,
695695 metadata : async ( val ) => {
696696 const match = input . processor . partFromToolCall ( options . toolCallId )
@@ -907,12 +907,13 @@ export namespace SessionPrompt {
907907
908908 await ReadTool . init ( )
909909 . then ( async ( t ) => {
910+ const model = await Provider . getModel ( info . model . providerID , info . model . modelID )
910911 const result = await t . execute ( args , {
911912 sessionID : input . sessionID ,
912913 abort : new AbortController ( ) . signal ,
913914 agent : input . agent ! ,
914915 messageID : info . id ,
915- extra : { bypassCwdCheck : true , ... info . model } ,
916+ extra : { bypassCwdCheck : true , model } ,
916917 metadata : async ( ) => { } ,
917918 } )
918919 pieces . push ( {
Original file line number Diff line number Diff line change @@ -95,14 +95,8 @@ export const ReadTool = Tool.define("read", {
9595 }
9696
9797 const isImage = isImageFile ( filepath )
98- const supportsImages = await ( async ( ) => {
99- if ( ! ctx . extra ?. [ "providerID" ] || ! ctx . extra ?. [ "modelID" ] ) return false
100- const providerID = ctx . extra [ "providerID" ] as string
101- const modelID = ctx . extra [ "modelID" ] as string
102- const model = await Provider . getModel ( providerID , modelID ) . catch ( ( ) => undefined )
103- if ( ! model ) return false
104- return model . capabilities . input . image
105- } ) ( )
98+ const model = ctx . extra ?. model as Provider . Model | undefined
99+ const supportsImages = model ?. capabilities . input . image ?? false
106100 if ( isImage ) {
107101 if ( ! supportsImages ) {
108102 throw new Error ( `Failed to read image: ${ filepath } , model may not be able to read images` )
You can’t perform that action at this time.
0 commit comments