File tree Expand file tree Collapse file tree 1 file changed +24
-22
lines changed
Expand file tree Collapse file tree 1 file changed +24
-22
lines changed Original file line number Diff line number Diff line change 214214 ; ; Execute each tool call concurrently
215215 (future
216216 (if @approved?*
217- (let [result ( f.tools/call-tool! name arguments @db* config messenger)]
217+ (do
218218 (assert-chat-not-stopped! chat-ctx)
219- (add-to-history! {:role " tool_call" :content (assoc tool-call
220- :details details
221- :summary summary
222- :origin origin)})
223- (add-to-history! {:role " tool_call_output" :content (assoc tool-call
224- :error (:error result)
225- :output result
226- :details details
227- :summary summary
228- :origin origin)})
229- (send-content! chat-ctx :assistant
230- (assoc-some
231- {:type :toolCalled
232- :origin origin
233- :name name
234- :arguments arguments
235- :error (:error result)
236- :id id
237- :outputs (:contents result)}
238- :details details
239- :summary summary)))
219+ (let [result (f.tools/call-tool! name arguments @db* config messenger)]
220+ (add-to-history! {:role " tool_call" :content (assoc tool-call
221+ :details details
222+ :summary summary
223+ :origin origin)})
224+ (add-to-history! {:role " tool_call_output" :content (assoc tool-call
225+ :error (:error result)
226+ :output result
227+ :details details
228+ :summary summary
229+ :origin origin)})
230+ (send-content! chat-ctx :assistant
231+ (assoc-some
232+ {:type :toolCalled
233+ :origin origin
234+ :name name
235+ :arguments arguments
236+ :error (:error result)
237+ :id id
238+ :outputs (:contents result)}
239+ :details details
240+ :summary summary))))
240241 (do
241242 (add-to-history! {:role " tool_call" :content tool-call})
242243 (add-to-history! {:role " tool_call_output"
253254 :id id}
254255 :details details
255256 :summary summary))))))))]
257+ (assert-chat-not-stopped! chat-ctx)
256258 ; ; Wait all tool calls to complete before returning
257259 (run! deref calls)
258260 (send-content! chat-ctx :system {:type :progress :state :running :text " Generating" })
You can’t perform that action at this time.
0 commit comments