mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修复节点直接回答,不同节点响应用回车隔开 (#935)
(cherry picked from commit 8453ea2b4b)
This commit is contained in:
parent
1721344cc6
commit
77814972a4
|
|
@ -28,8 +28,9 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
|
|||
for key in step_variable:
|
||||
node.context[key] = step_variable[key]
|
||||
if workflow.is_result() and 'answer' in step_variable:
|
||||
yield step_variable['answer']
|
||||
workflow.answer += step_variable['answer']
|
||||
answer = step_variable['answer'] + '\n'
|
||||
yield answer
|
||||
workflow.answer += answer
|
||||
if global_variable is not None:
|
||||
for key in global_variable:
|
||||
workflow.context[key] = global_variable[key]
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
|
|||
for chunk in response:
|
||||
answer += chunk.content
|
||||
yield chunk.content
|
||||
answer += '\n'
|
||||
yield '\n'
|
||||
_write_context(node_variable, workflow_variable, node, workflow, answer)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
|
|||
for chunk in response:
|
||||
answer += chunk.content
|
||||
yield chunk.content
|
||||
answer += '\n'
|
||||
yield '\n'
|
||||
_write_context(node_variable, workflow_variable, node, workflow, answer)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue