Repository navigation
feat(reader): page presets and 发给主会话 for the page question (#456, 2/4) - #482
Merged
Merged
Conversation
- Four built-in presets for a page (讲解这一页 / 翻译这一页 / 按知识点拆分这一页 / 提取这一页的公式与代码) through the shared QuickIntents (now its own file, used by the passage chips too, which send exactly what they sent before). - materials.selection.ask takes an optional intent (explain, translate, points, extract) that chooses one fixed instruction sentence in lib/ask-prompt.js; every earlier prompt is byte-identical (hash test). - New hand-off reader.page (ui/agent-prompts/reader.js): material name, page, the page's saved text (cut at PAGE_EVIDENCE_MAX and said), the typed question, and a last line to paste the screenshot (new tail 'image'). PageAsk: a quiet link under the answers; the way forward (secondary) on a page without saved text. Shown only inside the app (services context). - Preview: ui/dev.jsx accepts a QA stand-in for the chat input box (window.STUDY_QA_CHAT); scripts/qa/page-ask.mjs: preset chip answers from the page, hand-off fills the box and never over typed text, image-only page. - Docs (pdf-workflow en/zh), changelog fragments. Refs #456
… hand-off from the clipboard
…wording; explicit preset wins (#482 review) - The question typed on a page is held per page and never sent from another page; a page without saved text sends no typed words (pageHandOffInput). - Wording never promises the main chat reads pictures: if your chat takes pictures, paste the screenshot; press the link first, then take the screenshot (the clipboard fallback would replace a copied screenshot). - askSystemPrompt: an explicit translate/points/extract preset wins over the explanation regex; every no-intent prompt stays byte-identical. - askRequest / retryOf (ask-request.js) with tests: a chip click sends its intent, 重试 re-sends node.intent. - 翻译这一页 says on hover it is a one-off answer, not the reader's kept translation (Read toolbar 翻译). Docs and changelog reworded; Not verified says exactly how the hand-off fill is tested (real host adapter, faked DSH). - QA: page 4's message carries no question from page 2; page 2 keeps its draft. Refs #456
This was referenced Oct 25, 2026
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.
PR 2 of 4 for #456, on top of #479 (merged). It covers asking about a page in 原始 PDF: built-in presets, and 发给主会话 for what the built-in answer cannot do (figures, scanned pages).
What
Presets for a page
Under the question box of the page panel (
PageAsk.jsx) there are four chips: 讲解这一页 / 翻译这一页 / 按知识点拆分这一页 / 提取这一页的公式与代码.Tooltipgroup (notitle=).QuickIntentsmoved toui/document-preview/QuickIntents.jsxand takes a list:PASSAGE_INTENTS(unchanged, still has 出题考我) andPAGE_INTENTS.Prompt modes
materials.selection.asktakes an optionalintent:explain,translate,pointsorextract. It is listed inlib/ask-prompt.jsASK_INTENTSand in the contract.explainuses the explanation skeleton, as 没听懂 does;translatetranslates into the request language;pointssplits the page into knowledge points with short quotes;extractcopies formulas (LaTeX) and code verbatim, or says plainly there are none.ui/document-preview/ask-request.js(askRequest). The intent is kept on the thread node, and 重试 re-sends it (retryOf).发给主会话 for a page
reader.page, built inui/agent-prompts/reader.js. The message carries:PAGE_EVIDENCE_MAX, the same cap as the built-in answer, and the message says when it was cut;image): 「这一页的截图(主会话能看图片时,粘贴在这里):」.HandOffpiece. It only fills the chat input box, never sends, and never writes over text already typed there.secondary, never primary). It carries only the material name and the page number.serviceHandoff,chatHandOff) are unchanged.Other changes
en.selection.json,en.agent.json).docs/pdf-workflow.mdand.zh-CN.md.changes/unreleased/reader-page-chips-handoff.{en,zh-CN}.md.What not
How verified
node scripts/test.mjs --fastat e59fc04 (API keys unset): 7751 tests, 7749 pass, 0 fail, 2 skipped.changelog:checkpasses.tests/ask-prompt.test.mjs: byte identity (hashes); the mode sentences; an explicit preset beats the explanation regex (no skeleton, no term markers);normalizeIntent.tests/materials-ask-shape.test.mjs: the intent reaches the instructions and not the input; an unknown intent is refused; the contract enum.tests/reader-panel-flow.test.mjs:scope: 'page'andintent;node.intent;tests/hand-off-registry.test.mjs: areader.pagefixture in every shared check (layout, both languages, hostiletitle/text/questionstay in their fences), plus the cut note, the empty page, the conditional screenshot line and the first sentence.tests/hand-off-places.test.mjs:reader.pageis used twice inPageAsk.jsx.scripts/qa/page-ask.mjsuses a generated PDF and the preview fake model. The preview has no main chat, so 发给主会话 copies there and the QA reads the clipboard. All 16 steps pass with 0 page, console or API errors in zh dark 1440, zh dark 420 and en light 1440. New steps:Known limits / Not verified
tests/hand-off-browser.test.mjs, which runs the real host adapter (ui/host/workspace.jsx) against a faked DSH conversation, not a real one, and bytests/hand-off-unit.test.mjs. This PR does not change either.Refs #456