fix: handle missing </think> tag in remove_reasoning_text

This commit is contained in:
lck
2025-05-28 02:26:41 +08:00
parent b3672c60c0
commit c8df9e759c
+4 -2
View File
@@ -140,8 +140,10 @@ class Agent():
Remove the reasoning block of reasoning model like deepseek.
"""
end_tag = "</think>"
end_idx = text.rfind(end_tag)+8
return text[end_idx:]
end_idx = text.rfind(end_tag)
if end_idx == -1:
return text
return text[end_idx+8:]
def extract_reasoning_text(self, text: str) -> None:
"""