tui: pasting a PDF path auto-attaches it, which text-only models cannot read
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu tại packages/tui/src/component/prompt/index.tsx, nơi pasteInputText() kiểm tra các đường dẫn được dán và pasteAttachment() gắn nhãn cho tệp đính kèm. Theo dõi cách xử lý các tệp đính kèm nhị phân và kiểm tra các bài kiểm thử prompt hiện có về hành vi dán. Công việc hoàn tất khi việc dán đường dẫn PDF không còn khiến yêu cầu gửi đến mô hình chỉ xử lý văn bản bị lỗi, đồng thời đáp ứng hành vi mà issue mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Pasting a path to an existing PDF into the prompt auto-attaches the file as [PDF 1]. With a text-only model (no PDF input), sending the message fails, and there is no setting to disable this auto-attachment.
Environment
- opencode version: 2.0.32
- OS: Linux 7.2.9-arch1-1 (Arch Linux, x86_64)
- Terminal: xterm-256color
- Shell: /usr/bin/zsh
- Install/channel: packaged binary at
/usr/bin/opencode(latest) - Active plugins: none found in config
Reproduction
- Copy the absolute path of an existing PDF (e.g.
/home/user/Downloads/paper.pdf). - Paste it into the prompt.
- The prompt inserts a
[PDF 1]attachment instead of the path text. - Send the message with a model that does not accept PDF input.
- The request fails:
this model does not support pdf input.
Reproducible consistently.
Expected Behavior
Pasting a document path should insert the path as text so the agent can read it with tools. Auto-attachment should be limited to images, which vision-capable models can consume — or there should be a setting to disable file-path auto-attachment.
Actual Behavior
Any pasted text that resolves to an existing binary file is attached. PDFs become [PDF n], which text-only models cannot read, so the turn fails instead of passing the path to the agent.
Additional Context
Relevant code: packages/tui/src/component/prompt/index.tsx
pasteInputText()computespastedFilepath(text), callsreadLocalAttachment(filepath), and forattachment.type === "binary"callspasteAttachment().pasteAttachment()labels PDFs as[PDF n]and images as[Image n].
Possible fixes (either):
- Only auto-attach images; insert everything else as text:
if (attachment?.type === "binary") {
if (!attachment.mime.startsWith("image/")) {
input.insertText(normalizedText)
return
}
await pasteAttachment({ filename, filepath, mime: attachment.mime, content: ... })
return
}
- Add a CLI setting (e.g. in
~/.config/opencode/cli.json), such as:
{ "prompt": { "paste_attach": "images" } }
with values images | all | never.
The second keeps the current behavior available for users who do want document attachments.
- Ngôn ngữ chính
- TypeScript
- Star
- 215k
- Fork
- 28.9k
- Merge trung bình
- 8 giờ 11 phút
- Pull request đã merge (30 ngày)
- 365
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 anomalyco/opencode
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
anomalyco/opencode#57711 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending close triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
anomalyco/opencode#57664 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anomalyco/opencode#57579 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anomalyco/opencode#57536 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fs: /cd and file pickers fail on FreeBSD/ZFS — `stat` throws "dev exceeds the safe integer range" (fixed in @effect/platform-node-shared 4.0.5)Có thể đã có người làm @argszero đã nhận 1 ngày trước. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
anomalyco/opencode#57518 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
chaitin/MonkeyCode#1437 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
rtdb-info-connected-order test: unhandled 'connection is closed' rejection fails the CLI suiteĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
carbon-design-system/carbon-ai-chat#2615 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
redhat-developer/rhdh-plugin-export-overlays#4486 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offlineCó thể đã có người làm @r2jaff đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ComposioHQ/composio#5054 ·
Maintainer thường phản hồi trong vòng 1 ngày