From 0265cc0403ea2540e1c90176aeeff15af81d4d61 Mon Sep 17 00:00:00 2001 From: Stream Date: Fri, 30 Jan 2026 21:17:19 +0800 Subject: [PATCH] fix: type check Signed-off-by: Stream --- api/core/workflow/nodes/llm/node.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/core/workflow/nodes/llm/node.py b/api/core/workflow/nodes/llm/node.py index 38924c27a8..d090542352 100644 --- a/api/core/workflow/nodes/llm/node.py +++ b/api/core/workflow/nodes/llm/node.py @@ -2527,8 +2527,15 @@ class LLMNode(Node[LLMNodeData]): key=lambda item: trace_state.tool_call_index_map.get(item.id or "", len(trace_state.tool_call_index_map)) ) + text_content: str + if aggregate.text: + text_content = aggregate.text + elif aggregate.structured_output: + text_content = json.dumps(aggregate.structured_output.structured_output) + else: + raise ValueError("Aggregate must have either text or structured output.") return LLMGenerationData( - text=aggregate.text or json.dumps(aggregate.structured_output.structured_output), + text=text_content, reasoning_contents=buffers.reasoning_per_turn, tool_calls=tool_calls_for_generation, sequence=sequence,