Summary
Allow users to attach PDF documents as context when generating requirements with the AI feature. PDFs (e.g. specifications, standards documents, process descriptions) would be sent alongside the text prompt so the model can reference their content.
Background
Image attachment support has been implemented (vision-capable models). PDF support is the next step for richer document context.
Approaches
Option A: OpenRouter file-parser plugin
OpenRouter offers a file-parser plugin that accepts PDF URLs or base64 data and extracts text server-side before sending to the model.
- Pros: No additional dependencies; works with any text model (not just vision models)
- Cons: Plugin availability and cost may vary; file size limits apply; relies on OpenRouter's extraction quality
Option B: Client-side extraction with pdf.js
Use Mozilla's pdf.js (or pdfjs-dist) to extract text from the PDF in the browser, then send the extracted text as part of the prompt.
- Pros: No server-side dependency; full control over extraction; works with any model
- Cons: Adds ~500 KB bundle size; complex PDFs (tables, images, scanned docs) may extract poorly; layout information is lost
Considerations
- Token consumption: PDF text can be very large. Need a character/token limit with a warning, similar to the existing image token cost warning.
- File size limit: Suggest max 20 MB per PDF.
- Max file count: Suggest max 2 PDFs (in addition to images).
- Scanned PDFs: Neither approach handles scanned/image-only PDFs well without OCR. Could combine with vision models for scanned pages.
- UI: Could reuse the existing image drop zone — extend accepted MIME types and show a document icon for PDFs instead of a thumbnail preview.
Acceptance Criteria
Summary
Allow users to attach PDF documents as context when generating requirements with the AI feature. PDFs (e.g. specifications, standards documents, process descriptions) would be sent alongside the text prompt so the model can reference their content.
Background
Image attachment support has been implemented (vision-capable models). PDF support is the next step for richer document context.
Approaches
Option A: OpenRouter
file-parserpluginOpenRouter offers a
file-parserplugin that accepts PDF URLs or base64 data and extracts text server-side before sending to the model.Option B: Client-side extraction with
pdf.jsUse Mozilla's
pdf.js(orpdfjs-dist) to extract text from the PDF in the browser, then send the extracted text as part of the prompt.Considerations
Acceptance Criteria
enandsv