fix: broaden DSML tail detection to independent markers

This commit is contained in:
Liang Jiaqing committed 2026-10-23 07:54:26 +08:00
1 parent 545017cea0
commit a9a36b4b21
1 file changed
+2 -1
+2 -1
View File
@@ -477,7 +477,8 @@ class GenericAgentHandler(BaseHandler):
return self._retry_or_exit("[ERROR] Blank response, regenerate and tooluse")
if '[!!! 流异常中断' in content[-100:] or '!!!Error:' in content[50:][-100:] or (content.endswith('</summary>') and len(content) < 100):
return self._retry_or_exit("[ERROR] Incomplete response. Regenerate and tooluse.")
if '</|DSML|' in content.rstrip()[-50:] and content.rstrip().endswith('>'):
tail = content.rstrip()[-50:]
if 'DSML' in tail and '|' in tail and tail.endswith('>'):
return self._retry_or_exit("[ERROR] Tool call format invalid; no tool was called. Regenerate using proper tool calls.")
if 'max_tokens !!!]' in content[-100:]:
return self._retry_or_exit("[ERROR] max_tokens limit reached. Use multi small steps to do it.")