Skip to content

Add file attachments to chat input box - #13115

Closed
fkn1987 wants to merge 2 commits into
continuedev:mainfrom
fkn1987:file-attachments
Closed

Add file attachments to chat input box#13115
fkn1987 wants to merge 2 commits into
continuedev:mainfrom
fkn1987:file-attachments

Conversation

@fkn1987

@fkn1987 fkn1987 commented Aug 10, 2026

Copy link
Copy Markdown

Summary

Adds the ability to attach non-image files (e.g. PDFs, text, archives) to the chat input box.

Changes

  • New \FileMessagePart\ type in core (\core/index.d.ts\ + \core/config/types.ts) carrying
    ame\ and \dataUrl.
  • Choke point: \constructMessages\ converts file parts to a text placeholder ([Attachment: name]) before messages reach any LLM provider, so providers never receive an unsupported part type.
  • Defense in depth for file parts in: \countTokens, \openaiTypeConverters\ (Chat Completions + Responses paths), \Anthropic, \Gemini, \stripImages, and console \Message\ rendering.
  • Editor: new TipTap \FileAttachment\ inline node with a NodeView chip (name + download via dataUrl), paste/drop handling for non-image files, and a paperclip toolbar button.

Tests

  • \constructMessages.test.ts: file parts are converted to [Attachment: name]\ without leaking the dataUrl; messages without file parts are unchanged.
  • \countTokens.test.ts: counting tokens for file parts does not throw.

Admin added 2 commits August 10, 2026 02:25
- New FileMessagePart type (core) + FileMessagePart handling in
  constructMessages (choke point converts file parts to text placeholders
  so providers never receive unsupported parts), countTokens, openaiTypeConverters,
  Anthropic, and stripImages.
- TipTap FileAttachment inline node + NodeView chip (name + download via dataUrl),
  paste plugin for non-image files, drop handling, paperclip toolbar button.
- Tests: constructMessages converts file parts to [Attachment: name] without
  leaking dataUrl; countTokens does not throw on file parts.
Adding FileMessagePart widened the non-text branch in several consumers that
assumed non-text parts are always images. Fix logFormatter, Gemini, console
Message, and countTokensAsync to handle file parts, and keep constructMessages
narrowing intact when sanitizing file parts (preserve discriminated union).
@fkn1987
fkn1987 requested a review from a team as a code owner August 10, 2026 06:03
@fkn1987
fkn1987 requested review from sestinj and removed request for a team August 10, 2026 06:03
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


Admin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@fkn1987

fkn1987 commented Aug 10, 2026

Copy link
Copy Markdown
Author

Fechando — projeto errado. Desculpe o incômodo.

@fkn1987 fkn1987 closed this Aug 10, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant