多模态投递限流:每次模型调用最多携带一张图(多图上游只认最后一张,user 合并形态实测仍翻车)——engine 工具批内第一张图正常投递、其余降级为「下一轮单独重读」文字提示,逐轮收敛;同回合同图去重护栏保留(挡已投递图的反复重读)。发送形态 debug 日志(log.js 加 isDebugEnabled):只打角色/块数/image 计数/降级标记,不打 URL 与内容,「图没到模型」时一眼区分发送侧漏拼与上游吞图。definitions.json read_file 说明、ARCHITECTURE 图片链路与陷阱 7 同步两条铁律(图走批次后 user 合并 + 每轮至多一张,均系线上死循环实测复盘)

This commit is contained in:
2026-09-28 14:19:47 +08:00
parent e1bee18cd0
commit a250d57d10
4 changed files with 31 additions and 6 deletions
+1 -1
View File
@@ -202,7 +202,7 @@
"type": "function",
"function": {
"name": "read_file",
"description": "Reads the content of a file.\n\nText files: each returned line is prefixed with a line number right-aligned in a 6-character field, followed by a tab, then the line content.\n\nLarge text files (roughly over 16 KB) are not returned in full: you get an outline listing top-level symbols (or Markdown headings) with line numbers instead. The outline IS a successful response — do NOT retry the same call without a line range; use the outline line numbers with `start_line` / `end_line` to read specific sections. If no outline can be extracted, a first-1KB excerpt is returned instead. Supplying `start_line` or `end_line` disables outline mode.\n\nImage files (PNG, JPEG, WebP, GIF, BMP, TIFF) are returned as visual content you can analyze directly, but only if the current model supports vision; otherwise a text placeholder is returned — that placeholder is not an error. The tool result itself carries a text notice only; the actual image pixels arrive in a separate user message right after the batch of tool results, each image preceded by a label naming the read_file result it belongs to. Re-reading the same image within one turn returns a text-only notice without pixels — if an image never arrives, tell the user instead of retrying the read. Very large images (roughly over 50 MB) are skipped, and images may be downscaled (long edge ~2000 px, re-encoded as JPEG) before being returned.\n\nBinary files are not returned as text; a short notice is returned instead. Text files over 32 MB cannot be read by this tool — use `terminal` (grep -n / head / sed -n).",
"description": "Reads the content of a file.\n\nText files: each returned line is prefixed with a line number right-aligned in a 6-character field, followed by a tab, then the line content.\n\nLarge text files (roughly over 16 KB) are not returned in full: you get an outline listing top-level symbols (or Markdown headings) with line numbers instead. The outline IS a successful response — do NOT retry the same call without a line range; use the outline line numbers with `start_line` / `end_line` to read specific sections. If no outline can be extracted, a first-1KB excerpt is returned instead. Supplying `start_line` or `end_line` disables outline mode.\n\nImage files (PNG, JPEG, WebP, GIF, BMP, TIFF) are returned as visual content you can analyze directly, but only if the current model supports vision; otherwise a text placeholder is returned — that placeholder is not an error. The tool result itself carries a text notice only; the actual image pixels arrive in a separate user message right after the batch of tool results, each image preceded by a label naming the read_file result it belongs to. At most ONE image arrives per round: when several images are read in one batch only the first carries pixels and the rest come back as text asking you to read_file them individually next round — so read images one at a time when you need several, never re-read an image already delivered in this turn, and if pixels never arrive tell the user instead of retrying. Very large images (roughly over 50 MB) are skipped, and images may be downscaled (long edge ~2000 px, re-encoded as JPEG) before being returned.\n\nBinary files are not returned as text; a short notice is returned instead. Text files over 32 MB cannot be read by this tool — use `terminal` (grep -n / head / sed -n).",
"parameters": {
"type": "object",
"required": [