Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,9 +140,12 @@ graph.add_edge(START, "plan")
|
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
| 146 |
if plan_out.get("web_search_query") or plan_out.get("ocr_path") or plan_out.get("excel_path"):
|
| 147 |
return "tools"
|
| 148 |
return "finalize"
|
|
@@ -154,6 +157,7 @@ graph.add_conditional_edges(
|
|
| 154 |
)
|
| 155 |
|
| 156 |
|
|
|
|
| 157 |
graph.add_edge("tools", "run_tools")
|
| 158 |
|
| 159 |
# 5.e) run_tools → finalize
|
|
|
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
+
|
| 144 |
+
def route_plan(plan_out: AgentState) -> str:
|
| 145 |
+
"""
|
| 146 |
+
plan_out is exactly what plan_node returned (a partial AgentState).
|
| 147 |
+
If it set any of the tool-request keys, route to 'tools'; otherwise 'finalize'.
|
| 148 |
+
"""
|
| 149 |
if plan_out.get("web_search_query") or plan_out.get("ocr_path") or plan_out.get("excel_path"):
|
| 150 |
return "tools"
|
| 151 |
return "finalize"
|
|
|
|
| 157 |
)
|
| 158 |
|
| 159 |
|
| 160 |
+
|
| 161 |
graph.add_edge("tools", "run_tools")
|
| 162 |
|
| 163 |
# 5.e) run_tools → finalize
|