File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -292,16 +292,18 @@ async def chat(
292292 continue
293293
294294 last_step = event .state .steps [- 1 ] if event .state .steps else None
295- if last_step and last_step .tool is not None :
295+ if last_step and last_step .tool is not None and last_step . tool . name != FinalAnswerTool . name :
296296 trajectory_content = TrajectoryContent (
297297 input = last_step .input ,
298298 output = last_step .output ,
299299 error = last_step .error ,
300300 )
301- yield trajectory .trajectory_metadata (
301+ metadata = trajectory .trajectory_metadata (
302302 title = last_step .tool .name ,
303303 content = trajectory_content .model_dump_json (),
304304 )
305+ yield metadata
306+ await context .store (AgentMessage (metadata = metadata ))
305307
306308 if isinstance (last_step .output , FileCreatorToolOutput ):
307309 result = last_step .output .result
@@ -338,5 +340,6 @@ def serve():
338340 except KeyboardInterrupt :
339341 pass
340342
343+
341344if __name__ == "__main__" :
342345 serve ()
You can’t perform that action at this time.
0 commit comments