fix(feishu): avoid breaking tool hint formatting and think stripping

This commit is contained in:
Xubin Ren
2026-03-14 15:40:53 +00:00
parent 44af7eca3f
commit 19ae7a167e
3 changed files with 71 additions and 10 deletions

View File

@@ -163,13 +163,7 @@ class AgentLoop:
"""Remove <think>…</think> blocks that some models embed in content."""
if not text:
return None
# Remove complete think blocks (non-greedy)
cleaned = re.sub(r"<think>[\s\S]*?</think>", "", text)
# Remove any stray closing tags left without opening
cleaned = re.sub(r"</think>", "", cleaned)
# Remove any stray opening tag and everything after it (incomplete block)
cleaned = re.sub(r"<think>[\s\S]*$", "", cleaned)
return cleaned.strip() or None
return re.sub(r"<think>[\s\S]*?</think>", "", text).strip() or None
@staticmethod
def _tool_hint(tool_calls: list) -> str: