Skip to content

Commit f95d200

Browse files
YYH211xxYyh
andauthored
openai_fix (#161)
Co-authored-by: xxYyh <[email protected]>
1 parent c0a160b commit f95d200

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/legacy/multi_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ async def supervisor_tools(state: ReportState, config: RunnableConfig) -> Comma
278278
question_obj = cast(Question, observation)
279279
result.append({"role": "assistant", "content": question_obj.question})
280280
return Command(goto=END, update={"messages": result})
281+
elif tool_call["name"] == "FinishReport":
282+
result.append({"role": "user", "content": "Report is Finish"})
283+
return Command(goto=END, update={"messages": result})
281284
elif tool_call["name"] == "Sections":
282285
sections_list = cast(Sections, observation).sections
283286
elif tool_call["name"] == "Introduction":
@@ -340,7 +343,7 @@ async def supervisor_should_continue(state: ReportState) -> str:
340343
messages = state["messages"]
341344
last_message = messages[-1]
342345
# End because the supervisor asked a question or is finished
343-
if not last_message.tool_calls or (len(last_message.tool_calls) == 1 and last_message.tool_calls[0]["name"] == "FinishReport"):
346+
if not last_message.tool_calls:
344347
# Exit the graph
345348
return END
346349

0 commit comments

Comments
 (0)