Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

tui: pasting a PDF path auto-attaches it, which text-only models cannot read

オープン 初心者向け
#57,698 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
cli, frontend

調査の方向性

packages/tui/src/component/prompt/index.tsx から始めます。ここでは pasteInputText() が貼り付けられたパスを確認し、pasteAttachment() が添付ファイルにラベルを付けます。バイナリ添付ファイルがどのように処理されるかをたどり、貼り付け動作に関する既存のプロンプトテストを確認してください。PDF のパスを貼り付けてもテキスト専用モデルへのリクエストが失敗しなくなり、issue で期待されている動作が満たされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

  1. Copy the absolute path of an existing PDF (e.g. /home/user/Downloads/paper.pdf).
  2. Paste it into the prompt.
  3. The prompt inserts a [PDF 1] attachment instead of the path text.
  4. Send the message with a model that does not accept PDF input.
  5. 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() computes pastedFilepath(text), calls readLocalAttachment(filepath), and for attachment.type === "binary" calls pasteAttachment().
  • pasteAttachment() labels PDFs as [PDF n] and images as [Image n].

Possible fixes (either):

  1. 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
}
  1. 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.

主要言語
TypeScript
スター
215k
フォーク
28.9k
平均マージ
8時間 11分
マージ済み PR(30日)
365

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。