From b1f72a202ec770f4e16573a293cc242db4493677 Mon Sep 17 00:00:00 2001 From: Liang Jiaqing Date: Fri, 17 Apr 2026 00:04:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20clarify=20file=5Fwrite=20usage=20?= =?UTF-8?q?=E2=80=94=20content=20before=20call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/tools_schema.json | 2 +- ga.py | 5 ++--- memory/subagent.md | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/tools_schema.json b/assets/tools_schema.json index e0b281c..989ade3 100644 --- a/assets/tools_schema.json +++ b/assets/tools_schema.json @@ -29,7 +29,7 @@ }}, {"type": "function", "function": { "name": "file_write", - "description": "Create/overwrite/append files. ONLY for HUGE edits. Content in tags or reply code blocks. Supports {{file:path:startLine:endLine}}, auto-expanded", + "description": "Create/overwrite/append files. ONLY for HUGE edits. Place ... in reply body BEFORE the file_write call. Supports {{file:path:startLine:endLine}}, auto-expanded", "parameters": {"type": "object", "properties": { "path": {"type": "string", "description": "File path"}, "mode": {"type": "string", "enum": ["overwrite", "append", "prepend"], "description": "Write mode", "default": "append"}}} diff --git a/ga.py b/ga.py index 0315db4..9e746c6 100644 --- a/ga.py +++ b/ga.py @@ -364,8 +364,7 @@ class GenericAgentHandler(BaseHandler): def do_file_write(self, args, response): '''用于对整个文件的大量处理,精细修改要用file_patch。 - 需要将要写入的内容放在标签内,或者放在代码块中。 - ''' + 需要将要写入的内容放在标签内,或者放在代码块中''' path = self._get_abs_path(args.get("path", "")) mode = args.get("mode", "overwrite") # overwrite/append/prepend action_str = {"prepend": "Prepending to", "append": "Appending to"}.get(mode, "Overwriting") @@ -381,7 +380,7 @@ class GenericAgentHandler(BaseHandler): blocks = extract_robust_content(response.content) if not blocks: yield f"[Status] ❌ 失败: 未在回复中找到代码块内容\n" - return StepOutcome({"status": "error", "msg": "No content found. Put content inside ... tags in your reply body and call file_write."}, next_prompt="\n") + return StepOutcome({"status": "error", "msg": "No content found. Put content inside ... tags in your reply body before call file_write."}, next_prompt="\n") try: new_content = expand_file_refs(blocks, base_dir=self.cwd) if mode == "prepend": diff --git a/memory/subagent.md b/memory/subagent.md index a505492..eb86291 100644 --- a/memory/subagent.md +++ b/memory/subagent.md @@ -5,7 +5,8 @@ - 目录:`temp/{task_name}/`(cwd在temp/时即`./{task_name}/`) - 启动:`python agentmain.py --task {name} [--input "短文本"] [--bg] [--llm_no N]`(cwd=代码根) - `--input`自动建目录+清旧output+写input.txt;长文本先手动写input.txt再启动(不带--input) -- `--bg`后台(print PID exit),可同一code_run内sleep后poll;非--bg禁合并启动+轮询 +- 优先用`--bg`后台(print PID exit),可同一code_run内sleep后poll;非--bg禁合并启动+轮询 +- subagent的cwd还是temp,不是task目录 - input:目标+约束即可,subagent同等智能。**禁写步骤/过度描述**,大量数据给路径 - 通信:output.txt(append,`[ROUND END]`=轮完成) → 写reply.txt继续 → 不写10min退出。reply后输出为output1/2/3.txt(同格式) - 干预文件:`_stop`(当轮结束退出) | `_keyinfo`(注入working memory) | `_intervene`(追加指令)