fix: 修复节点直接回答,不同节点响应用回车隔开 (#935)
This commit is contained in:
parent
864bca6450
commit
8453ea2b4b
@ -28,8 +28,9 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
|
|||||||
for key in step_variable:
|
for key in step_variable:
|
||||||
node.context[key] = step_variable[key]
|
node.context[key] = step_variable[key]
|
||||||
if workflow.is_result() and 'answer' in step_variable:
|
if workflow.is_result() and 'answer' in step_variable:
|
||||||
yield step_variable['answer']
|
answer = step_variable['answer'] + '\n'
|
||||||
workflow.answer += step_variable['answer']
|
yield answer
|
||||||
|
workflow.answer += answer
|
||||||
if global_variable is not None:
|
if global_variable is not None:
|
||||||
for key in global_variable:
|
for key in global_variable:
|
||||||
workflow.context[key] = global_variable[key]
|
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:
|
for chunk in response:
|
||||||
answer += chunk.content
|
answer += chunk.content
|
||||||
yield chunk.content
|
yield chunk.content
|
||||||
|
answer += '\n'
|
||||||
|
yield '\n'
|
||||||
_write_context(node_variable, workflow_variable, node, workflow, answer)
|
_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:
|
for chunk in response:
|
||||||
answer += chunk.content
|
answer += chunk.content
|
||||||
yield chunk.content
|
yield chunk.content
|
||||||
|
answer += '\n'
|
||||||
|
yield '\n'
|
||||||
_write_context(node_variable, workflow_variable, node, workflow, answer)
|
_write_context(node_variable, workflow_variable, node, workflow, answer)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user