mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-07-31 14:51:58 +08:00
fix: handle array json
This commit is contained in:
parent
b3728bca52
commit
a8b126b17d
@ -208,8 +208,8 @@ class LLMNode(BaseNode[LLMNodeData]):
|
|||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
# if the result_text is not a valid json, try to repair it
|
# if the result_text is not a valid json, try to repair it
|
||||||
structured_output = json_repair.loads(result_text)
|
structured_output = json_repair.loads(result_text)
|
||||||
if not isinstance(structured_output, dict):
|
if not isinstance(structured_output, dict | list):
|
||||||
raise LLMNodeError(f"Failed to parse structured output: {e}")
|
raise LLMNodeError(f"Failed to parse structured output: {result_text}")
|
||||||
outputs["structured_output"] = structured_output
|
outputs["structured_output"] = structured_output
|
||||||
yield RunCompletedEvent(
|
yield RunCompletedEvent(
|
||||||
run_result=NodeRunResult(
|
run_result=NodeRunResult(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user