mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-05 23:10:22 +08:00
- Backend: Convert non-string content (lists, dicts) to JSON strings in _create_event_stream_message to ensure frontend always receives string content - Frontend: Add type guard before calling startsWith() on toolCall.result for defensive programming This fixes the TypeError: toolCall.result.startsWith is not a function when tools return complex objects.
This commit is contained in:
@@ -157,6 +157,10 @@ def _create_event_stream_message(
|
||||
message_chunk, message_metadata, thread_id, agent_name
|
||||
):
|
||||
"""Create base event stream message."""
|
||||
content = message_chunk.content
|
||||
if not isinstance(content, str):
|
||||
content = json.dumps(content, ensure_ascii=False)
|
||||
|
||||
event_stream_message = {
|
||||
"thread_id": thread_id,
|
||||
"agent": agent_name,
|
||||
@@ -166,7 +170,7 @@ def _create_event_stream_message(
|
||||
"langgraph_node": message_metadata.get("langgraph_node", ""),
|
||||
"langgraph_path": message_metadata.get("langgraph_path", ""),
|
||||
"langgraph_step": message_metadata.get("langgraph_step", ""),
|
||||
"content": message_chunk.content,
|
||||
"content": content,
|
||||
}
|
||||
|
||||
# Add optional fields
|
||||
|
||||
Reference in New Issue
Block a user