From 3d76179a01e1a09112859224aeef218c8ace7a2a Mon Sep 17 00:00:00 2001 From: goulustis Date: Mon, 26 Jan 2026 17:40:09 +0800 Subject: [PATCH] better get human msg --- lang_agent/graphs/routing.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lang_agent/graphs/routing.py b/lang_agent/graphs/routing.py index b135134..cb0e99d 100644 --- a/lang_agent/graphs/routing.py +++ b/lang_agent/graphs/routing.py @@ -130,7 +130,12 @@ class RoutingGraph(GraphBase): get user message of current invocation """ msgs = state["inp"][0]["messages"] - candidate_hum_msg = msgs[1] + + candidate_hum_msg = None + for msg in msgs: + if isinstance(msg, HumanMessage): + candidate_hum_msg = msg + assert isinstance(candidate_hum_msg, HumanMessage), "not a human message" return candidate_hum_msg