From c8df9e759c4d698d203a724a9200317fd08a51e7 Mon Sep 17 00:00:00 2001 From: lck Date: Wed, 28 May 2025 02:26:41 +0800 Subject: [PATCH] fix: handle missing tag in remove_reasoning_text --- sources/agents/agent.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/agents/agent.py b/sources/agents/agent.py index 0e6bfaf..15d6ae0 100644 --- a/sources/agents/agent.py +++ b/sources/agents/agent.py @@ -140,8 +140,10 @@ class Agent(): Remove the reasoning block of reasoning model like deepseek. """ end_tag = "" - 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: """