vision input fails
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu với src/tools/read-file/read-file.ts và src/utils/file-references.ts, sau đó so sánh cách xử lý dữ liệu nhị phân của chúng với src/utils/clipboard-image.ts. Tái hiện bằng cmd -p với một hình ảnh cục bộ và theo dõi cách tệp đi đến model; hoàn thành khi các tệp hình ảnh được hỗ trợ, bao gồm các định dạng được nêu trong issue, tạo ra vision content ở headless mode thay vì chỉ có văn bản hoặc bị bỏ qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Vision input currently works only through interactive TUI clipboard-paste and drag-drop (detectDroppedImageFile / detectClipboardImage → Jimp → base64 → {type:"image"}).
Environment
- cmd v0.38.2
- Installed via npm i -g command-code (mise)
- macOS (darwin)
- Model: Claude Sonnet 4 (claude-4-sonnet-20250514) — confirmed inputModalities: ["text","image"]
Reproduce
1. Put any JPEG or PNG in the working directory
2. Run:
cmd -p "Describe what you see in test.jpg"
Result: Model responds that it cannot visually inspect the image. Same result for PNG, GIF, WEBP.
Root cause (from inspecting dist/index.mjs)
- read_file returns text-only output for all binary files
src/tools/read-file/read-file.ts → formatOutput:
function formatOutput(e) {
if ("binary" === e.contentType)
return [...,Binary file: ${e.fileType}].join("\n");
// Model only ever sees: "Binary file: image/jpeg"
...
}
No {type: "image"} content block is ever created from a file read. The raw bytes are read into a Buffer but discarded. - @filepath references silently skip binary files
src/utils/file-references.ts → processFileReferences:
if ("binary" === i.contentType) continue; // images vanish entirely - AVIF and other modern formats fall through to the text path
getFileType uses a hardcoded extension map (Ib) with no .avif entry:
Ib = { ".png":"image/png", ".jpg":"image/jpeg", ".jpeg":"image/jpeg",
".gif":"image/gif", ".webp":"image/webp", ".svg":"image/svg+xml",
".bmp":"image/bmp", ".ico":"image/x-icon", ... }
// No .avif, .heic, .heif, .tiff
Since getFileType(".avif") returns "unknown", and isBinaryFile("unknown") returns false (it only matches known MIME values), AVIF files are read as UTF-8 text — producing garbled output rather than being flagged as binary. - Vision content blocks only exist in the TUI paste/drag-drop path
src/utils/clipboard-image.ts → detectDroppedImageFile → Jimp resize → base64 → {type:"image"}. This path is a React/Ink interactive handler and is not reachable in headless mode.
Expected Behavior
..
Actual Behavior
..
Steps to reproduce the issue
..
Command Code Version
latest
Operating System
macOS
Terminal/IDE
No response
Shell
No response
Additional context
No response
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 4k
- Fork
- 350
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CommandCodeAI/command-code
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CommandCodeAI/command-code#855 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
CommandCodeAI/command-code#841 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CommandCodeAI/command-code#655 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CommandCodeAI/command-code#608 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
CommandCodeAI/command-code#893 ·
Tất cả issue của CommandCodeAI/command-code
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
JuliusBrussee/caveman#1102 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3263 ·
-
[Bug]: context-limit error parsing has no pattern for llama.cpp's "context size (N tokens)" phrasing Đang mởarea/compression area/local-models area/sessions comp/agent duplicate P2 sweeper:risk-session-state type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NousResearch/hermes-agent#117793 · 1 bình luận ·
-
possible bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Mintplex-Labs/anything-llm#6415 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100