File attachments require
BLOB_READ_WRITE_TOKEN. If you don’t need attachments, set integrations.attachments: false in chat.config.ts to run ChatJS without this env var.Supported File Types
| Type | Extensions | Processing |
|---|---|---|
| Images | .png, .jpg, .jpeg | Direct vision input |
| PDFs | .pdf | Text extraction |
How It Works
- User attaches file in chat input
- File uploads to Vercel Blob
- URL/content included in message
- Model processes based on type
Configuration
Enable/Disable
Toggle attachments inchat.config.ts:
- Attachment button is hidden from the chat input
- Drag-and-drop and paste file handling are disabled
- File upload API returns 503
Environment Variables
RequiresBLOB_READ_WRITE_TOKEN from Vercel Blob:
Attachment Settings
File attachment settings are configured inchat.config.ts under the attachments key:
Mobile Behavior
On mobile devices, the attachment button shows a dropdown menu with separate options:- Add photos - Opens the device photo gallery
- Take photo - Opens the camera directly
- Add files - Opens the file browser for PDFs and documents
Model Support
Not all models support attachments. Checkmodel.input for capability:
config.models.defaults.pdf and config.models.defaults.chatImageCompatible).