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)
This commit is contained in:
Kevin Hu 2025-03-11 10:41:19 +08:00 committed by GitHub
parent 780ee2b2be
commit 8e965040ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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())