Repository navigation
PDF attachments reach every provider: extracted text for models that cannot read PDFs (#466) - #1679
Conversation
Solenta-Message-Id: 49b07a62-7eba-4e78-af35-6933cd700199
Solenta-Message-Id: 021d9716-d51c-483f-86bb-4f6344245277
…t-attachments-not-just-im-9c6a24 # Conflicts: # scripts/package-app.sh # scripts/package-cross.sh # src/components/Composer.tsx # src/components/composer/AttachmentChip.tsx
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b43da3bf21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pdfjs.GlobalWorkerOptions.workerSrc = pathToFileURL( | ||
| require.resolve("pdfjs-dist/legacy/build/pdf.worker.min.mjs"), | ||
| ).href; | ||
| const task = pdfjs.getDocument({ |
There was a problem hiding this comment.
Ship and configure PDF.js character maps
For PDFs that reference a predefined, non-embedded CMap—common in CJK documents—PDF.js needs cMapUrl/cMapPacked to decode the font character codes. This call supplies neither, while both packaging scripts delete the bundled pdfjs-dist/cmaps directory, so affected packaged-app extractions produce missing text or fail and are silently reported as unextractable. Retain the CMap assets and point getDocument at them.
Useful? React with 👍 / 👎.
# Conflicts: # src/components/Composer.module.css # src/components/composer/AttachmentChip.tsx
Closes #466.
Attaching a spec PDF now works with every provider. Claude (its Read tool renders PDFs) and OpenCode (
run -f) still get the path. Codex, Kimi, Grok, Cursor and Muse used to get a path to a file they could not read; now Solenta extracts the text locally and points the agent at a.txtcopy.How it works
electron/pdf-text.jsruns pdfjs in a child process (ELECTRON_RUN_AS_NODE), so parsing never blocks the main process. A 30 s timeout kills it.userData/attachments/<threadId>/, which the existing image-store pruning already covers.PDF -> extracted .txt, a "first 100 pages only" note when capped, or "no text could be extracted" for scanned/protected files.UI
pdfTextflag, so the transcript chip shows the note only when extraction actually happened, even after a provider switch.Packaging
pdfjs-dist6.4.299 (exact pin).package-app.shandpackage-cross.shship onlypdf.min.mjsandpdf.worker.min.mjs(1.8 MB of 35 MB). The optional@napi-rs/canvasis not shipped; text extraction does not need it.verify-package.shchecks both files, because itsrequire()scan cannot seeimport().package-deps.test.jsnow also scansrequire.resolve(), so droppingpdfjs-distfrom either list fails CI.Testing
test:electronin a CI-like environment (stripped PATH, no inheritedCODER_*) after merging main: 4894 pass, 0 fail.typecheckandvite buildare clean.pdfTextflag land on a generic-provider runpackage-cross.shwas not run end to end.Out of scope, per the issue: office documents (
.docxetc.).🤖 Generated with Claude Code