Improve write_file fallback handling

This commit is contained in:
wuyang6
2026-05-12 19:52:41 +08:00
parent a48c86501a
commit 64787498dd
4 changed files with 93 additions and 21 deletions
+4 -5
View File
@@ -1614,11 +1614,10 @@ class LocalCodingAgent:
f'工具:{name};位置:line {exc.lineno} column {exc.colno}'
f'原因:{exc.msg};参数片段:{preview!r}'
'请回复“继续”,我会要求模型重新生成合法 JSON 参数;'
'对于 product-data 生成数据,不要用 write_file 写大段 draft'
'应每批最多 8 条,直接用 python_exec 的 script_path 模式调用 '
'skills/product-data/scripts/normalize_dataset_draft.py'
'通过 stdin 传入小批量 JSON,并把 normalize 结果追加到 '
'scratchpad/normalized_records.jsonl。'
'如果是 write_file 写多行文本,应改用 content_lines 或 content_base64'
'如果 write_file 仍不稳定,应改用 python_exec 作为通用写文件兜底;'
'如果是生成/转换结构化数据,应优先调用对应 skill 脚本或 python_exec'
'不要把大段 JSON/CSV/draft 直接塞进工具参数;bash 仅作为最后兜底。'
) from exc
if not isinstance(arguments, dict):
raise OpenAICompatError(