Repository navigation
Add open documents to an Ask AI conversation - #97
Draft
Ganesh75-web wants to merge 7 commits into
Draft
Ganesh75-web wants to merge 7 commits into
Ganesh75-web wants to merge 7 commits into
Conversation
Readers expose their text, password state and page navigation, and the tab list can name, read and show other open documents by content id. The ask request type gains optional attachments.
… menu focus Ask AI now leaves out an added document whose text can't be read instead of failing the question, and treats a document edited after it was added as no longer open. The picker stops at 20 documents, waits for saved history, and moves focus into and out of its menu. Citations of closed documents stay plain text.
Keep attachment aliases consistent in the picker, chips, provider payloads and file citations. Cover protected and unreadable attachments, saved metadata and the desktop multi-document flow. Initialize real pdf.js fixtures before test cases and stabilize hidden Windows rendering without changing normal app launches.
mberman84
requested changes
Nov 14, 2026
mberman84
left a comment
Collaborator
There was a problem hiding this comment.
I reproduced a citation opening the wrong PDF at 8276d50. Attach Report.pdf, get an answer citing page 2, remove that attachment, then attach a different file also named Report.pdf. Clicking the old answer’s citation now opens page 2 of the second file. A component regression check using two different content IDs reproduced this while the existing 12 attachment-panel tests passed.
AiPanel resolves citations for every answer using the current attachment list. If this proposal proceeds, bind each answer’s citations to the content IDs sent on that turn and keep a citation inactive when its original document is unavailable. The feature is still awaiting a scope decision in #93.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Ask AI can only read the current PDF, even when several documents are open. Comparing resumes or cross-checking reports requires a way to choose which other documents belong in the conversation.
Change
Add a "+" picker above the composer for other open PDFs. Selected documents appear as removable chips and are sent with the current document to ChatGPT, Claude, OpenRouter, or a custom endpoint. Filename-and-page citations jump to the corresponding tab; same-name files receive distinct labels.
The picker also prepares tabs that have not been visited yet without switching away from the conversation. Closed, edited, or unreadable attachments are skipped with a note beside the question. Up to 20 attachments share the existing text budget, with cuts at page boundaries and explicit notices when text cannot fit. OpenRouter/custom endpoints keep their whole-document truncation guard.
Saved history contains attachment names and content identifiers. Adding a password-protected document makes that conversation session-only. New conversation and Clear chats handle those attachments and privacy state, including delayed extraction and persistence writes.
Issue or approval
Implements the proposal in #93. Maintainer approval of the idea and scope is still pending, so this PR is a draft for review. No approval comment is available to link yet.
How I checked it
Verified on Windows against this branch:
npx vitest run --reporter=verbose: 21 files, 301 tests passed, including attachment preparation, stale/closed documents, protected-document history, conversation clearing, citations, and shared budgets.npx tsc --noEmitandnpm run build: passed.npm run smoke: passed the full hidden Windows run, including adding an unvisited tab without switching, multi-document requests, citation navigation, closed-document skips, and existing reader/printing regressions.node scripts/test-reader-security.mjs: passed all 10 checks, including untrusted document prompts, IPC validation, and metadata-only history.node scripts/test-chat-math.mjs: 18 checks passed; OpenRouter and custom endpoint suites passed 4 and 9 tests respectively.git diff --check: passed.Windows, macOS, and Linux CI all passed on commit 8276d50: CI run 43347848042. Each platform ran the full workflow, including the build and smoke checks. Provider payloads were checked with local fixtures; live provider responses have not been verified for this feature.
Before: several PDFs are open, but the conversation sees only the active document. Tab names in the example were anonymized.
After: the implemented panel has an add-document button and a removable chip for selected context. This screenshot comes from the hidden smoke run with a local test endpoint.
AI-assisted implementation and review: GPT-6.1 Sol via the Codex harness in T3 Code, with delegated agents.