浏览代码

Remove <think> content for `Generate` if it's not stream output. (#5281)

### What problem does this PR solve?

### Type of change

- [x] Refactoring
tags/v0.17.0
Kevin Hu 8 个月前
父节点
当前提交
bcc92e04c9
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1
    0
      agent/component/generate.py

+ 1
- 0
agent/component/generate.py 查看文件

@@ -198,6 +198,7 @@ class Generate(ComponentBase):
if len(msg) < 2:
msg.append({"role": "user", "content": "Output: "})
ans = chat_mdl.chat(msg[0]["content"], msg[1:], self._param.gen_conf())
ans = re.sub(r"<think>.*</think>", "", ans, flags=re.DOTALL)

if self._param.cite and "content_ltks" in retrieval_res.columns and "vector" in retrieval_res.columns:
res = self.set_cite(retrieval_res, ans)

正在加载...
取消
保存