From 404ea1947bdc57f5738a8430a928d2f6cc8f4e36 Mon Sep 17 00:00:00 2001 From: Liang Jiaqing Date: Wed, 1 Apr 2026 09:30:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20llmcore=E5=B7=A5=E5=85=B7=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=AD=A3=E5=88=99=E5=85=BC=E5=AE=B9tool=5Fcall?= =?UTF-8?q?=E6=A0=87=E7=AD=BE,=E6=9C=80=E5=B0=8F=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E6=94=B9=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ga.py | 2 +- llmcore.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ga.py b/ga.py index 5df48c5..e86e03d 100644 --- a/ga.py +++ b/ga.py @@ -388,7 +388,7 @@ class GenericAgentHandler(BaseHandler): blocks = extract_robust_content(response.content) if not blocks: - yield f"[Status] ❌ 失败: 未在回复中找到代码块内容\n" + yield f"[Status] ❌ 失败: 未在回复中找到代码块内容\n" return StepOutcome({"status": "error", "msg": "No content found, if you want a blank, you should use code_run"}, next_prompt="\n") try: new_content = expand_file_refs(blocks, base_dir=self.cwd) diff --git a/llmcore.py b/llmcore.py index 738f146..d6ef43e 100644 --- a/llmcore.py +++ b/llmcore.py @@ -748,7 +748,7 @@ class ToolClient: remaining_text = re.sub(think_pattern, "", remaining_text, flags=re.DOTALL) tool_calls = []; json_strs = []; errors = [] - tool_pattern = r"((?:(?!).){15,}?)" + tool_pattern = r"<(?:tool_use|tool_call)>((?:(?!<(?:tool_use|tool_call)>).){0,}?)"} tool_all = re.findall(tool_pattern, remaining_text, re.DOTALL) if tool_all: @@ -764,9 +764,9 @@ class ToolClient: json_strs.append(json_str) remaining_text = remaining_text.replace(''+weaktoolstr, "") elif '"name":' in remaining_text and '"arguments":' in remaining_text: - json_match = re.search(r"(\{.*\"name\":.*?\})", remaining_text, re.DOTALL | re.MULTILINE) + json_match = re.search(r'\{.*"name":.*\}', remaining_text, re.DOTALL) if json_match: - json_str = json_match.group(1).strip() + json_str = json_match.group(0).strip() json_strs.append(json_str) remaining_text = remaining_text.replace(json_str, "").strip()