fix: clarify file_write usage — content before call
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
}},
|
||||
{"type": "function", "function": {
|
||||
"name": "file_write",
|
||||
"description": "Create/overwrite/append files. ONLY for HUGE edits. Content in <file_content> tags or reply code blocks. Supports {{file:path:startLine:endLine}}, auto-expanded",
|
||||
"description": "Create/overwrite/append files. ONLY for HUGE edits. Place <file_content>...</file_content> 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"}}}
|
||||
|
||||
5
ga.py
5
ga.py
@@ -364,8 +364,7 @@ class GenericAgentHandler(BaseHandler):
|
||||
|
||||
def do_file_write(self, args, response):
|
||||
'''用于对整个文件的大量处理,精细修改要用file_patch。
|
||||
需要将要写入的内容放在<file_content>标签内,或者放在代码块中。
|
||||
'''
|
||||
需要将要写入的内容放在<file_content>标签内,或者放在代码块中'''
|
||||
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] ❌ 失败: 未在回复中找到<file_content>代码块内容\n"
|
||||
return StepOutcome({"status": "error", "msg": "No content found. Put content inside <file_content>...</file_content> tags in your reply body and call file_write."}, next_prompt="\n")
|
||||
return StepOutcome({"status": "error", "msg": "No content found. Put content inside <file_content>...</file_content> 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":
|
||||
|
||||
@@ -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`(追加指令)
|
||||
|
||||
Reference in New Issue
Block a user