Skip to content

fix: 修复直接回答对话无法显示文本 #1620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/application/flow/i_step_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
if workflow.is_result(node, NodeResult(step_variable, global_variable)) and 'answer' in step_variable:
answer = step_variable['answer']
yield answer
workflow.append_answer(answer)
node.answer_text = answer
if global_variable is not None:
for key in global_variable:
workflow.context[key] = global_variable[key]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此段代码无明显不规范的情况但缺少一些必要的细节来提高可读性和执行效率。

首先,yield answerworkflow.append_answer(answer) 应该是同时进行处理以保证上下文顺序的一致性。
此外,

  1. 使用变量名前缀“node.” 或 “workflow.” 可能使其他读者更容易理解其作用和位置;
  2. 将注释中的部分文字转换成更具描述性的语句以提高代码易懂度。

Expand Down
Loading