Skip to content

feat: 去除工作流直接返回内容的标题数据 #1575

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

Closed
wants to merge 2 commits into from

Conversation

shaohuzhang1
Copy link
Contributor

fix: 添加对话stream流式结束标记
feat: 去除工作流直接返回内容的标题数据

Copy link

f2c-ci-robot bot commented Nov 7, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -73,7 +73,7 @@ def execute(self, dataset_id_list, dataset_setting, question,
[f"{reset_title(paragraph.get('title', ''))}{paragraph.get('content')}" for paragraph in
paragraph_list])[0:dataset_setting.get('max_paragraph_char_number', 5000)],
'directly_return': '\n'.join(
[f"{reset_title(paragraph.get('title', ''))}{paragraph.get('content')}" for paragraph in
[paragraph.get('content') for paragraph in
result if
paragraph.get('is_hit_handling_method')]),
'question': question},

Choose a reason for hiding this comment

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

没有发现明显的问题或异常,在现有的情况下是正确的。如果您有任何其他特殊要求或特定问题,请告诉我,以便我为您提供更详细和针对性的反馈。

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.

该段代码看起来是用于处理与对话相关的任务的,但它包含了一些不太一致的地方。以下是针对这些地方提出的一些建议:

  1. 定义run_chain函数时,可以提供一个参数params而不是self.

  2. 在调用get_chunk_content之前使用`yield self```来确保返回的数据被适当地关闭。

  3. 调用其他链的运行时,直接传递链的当前节点作为第一个参数,并在执行完后将结果作为一个future提交给异步线程池中的submit方法即可。

通过实施上述修改,代码的质量会更高,更符合编程规范和最佳实践的要求。请根据最新的编程标准更新这段代码,以使其更加现代和健壮。

@shaohuzhang1 shaohuzhang1 deleted the pr@main@feat_directly_return_title branch November 7, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants