mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 05:56:31 +08:00
feat: hide output tools and improve JSON formatting for structured output
This commit is contained in:
parent
ecf4c06ed7
commit
8850a0c5c7
@ -2282,11 +2282,12 @@ class LLMNode(Node[LLMNodeData]):
|
||||
if tool_name in (OUTPUT_TEXT_TOOL, FINAL_OUTPUT_TOOL):
|
||||
content = payload.tool_args["text"]
|
||||
elif tool_name == FINAL_STRUCTURED_OUTPUT_TOOL:
|
||||
content = json.dumps(
|
||||
raw_content = json.dumps(
|
||||
payload.tool_args["data"],
|
||||
ensure_ascii=False,
|
||||
indent=2
|
||||
)
|
||||
content = f"```json\n{raw_content}\n```"
|
||||
|
||||
if content:
|
||||
yield StreamChunkEvent(
|
||||
@ -2296,7 +2297,7 @@ class LLMNode(Node[LLMNodeData]):
|
||||
)
|
||||
yield StreamChunkEvent(
|
||||
selector=[self._node_id, "generation", "content"],
|
||||
chunk=f"```json\n{content}\n```",
|
||||
chunk=content,
|
||||
is_final=False,
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user