浏览代码

Fix: rm <think> for ES sql generation. (#5881)

### What problem does this PR solve?

#5850

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.17.1
Kevin Hu 7 个月前
父节点
当前提交
8e965040ce
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1
    0
      api/db/services/dialog_service.py

+ 1
- 0
api/db/services/dialog_service.py 查看文件

@@ -341,6 +341,7 @@ Please write the SQL, only SQL, without any other explanations or text.
nonlocal sys_prompt, user_prompt, question, tried_times
sql = chat_mdl.chat(sys_prompt, [{"role": "user", "content": user_prompt}], {
"temperature": 0.06})
sql = re.sub(r"<think>.*</think>", "", sql, flags=re.DOTALL)
logging.debug(f"{question} ==> {user_prompt} get SQL: {sql}")
sql = re.sub(r"[\r\n]+", " ", sql.lower())
sql = re.sub(r".*select ", "select ", sql.lower())

正在加载...
取消
保存