Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: 添加对话stream流式结束标记 #1572

Merged
merged 1 commit into from
Nov 7, 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/workflow_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ def await_result(self, result):
if chunk is None:
break
yield chunk
yield self.get_chunk_content('', True)
finally:
self.work_flow_post_handler.handler(self.params['chat_id'], self.params['chat_record_id'],
self.answer,
self)
yield self.get_chunk_content('', True)

def run_chain_async(self, current_node):
future = executor.submit(self.run_chain, current_node)

Choose a reason for hiding this comment

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

该段落描述的是一个处理异步数据流的方法,其中await_result方法用于等待获取结果后的数据。但是没有提到它与上下文之间的关系或其他细节信息。因此,关于当前问题的详细分析和可能的优化建议将取决于具体的应用场景。

不过,根据通常的情况,这个函数可以包含以下几点改进:

  1. 增加参数:在定义或调用其他方法前提供更详细的参数类型(例如,如果用户想要指定特定内容格式或编码方式)。
  2. 异常处理:确保优雅地管理可能导致错误的操作,并通过适当的异常来通知用户发生什么。
  3. 捕获断言:对一些关键检查点添加断言来增加代码可读性和可靠性。
  4. 提供文档/注释:虽然这些已经包含了足够的说明信息,但在后续开发过程中的文档更新中可能会有所帮助。
  5. 函数复用:考虑是否可以在同一个类内为多个子任务创建类似的功能块,以便更好地重用资源并提高代码维护性。

综上所述,在具体的上下文中加入额外的信息后,对于这种情况下可能存在的不同需求,上述策略都应该能带来一定的帮助。

Expand Down
Loading