106 Commits

Author SHA1 Message Date
Marcello Pichini
863327af2a fix(hints): keep leading -, * and # that belong to the hint (#2852)
The composer-hint sanitizers used lstrip("-•*# ") to drop list markers,
which also ate the sign of "-3 squared...?", the star of "*args" and
the hash of "#include". Strip a marker only when whitespace follows it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:25:50 +08:00
PP1
9744bad61b fix: reject empty normalized quiz evidence (#2769) 2026-12-01 00:25:11 +08:00
wojiecihuo
fed428e46a Merge pull request #3079 from zszz3/fix/chat-runtime-snapshots
fix: keep turn data out of the chat system prompt and drop the duplicate tool manifest
2026-11-30 23:21:32 +08:00
cro3w
d77ad8f6c4 fix(reading): isolate document ingestion from the API process (#2988)
* fix(reading): isolate document ingestion from the API process

(cherry picked from commit f0fd1f785eb1070f689816b0977bf4c60125f95a)

* chore(api): refresh router index for the reading routes

---------

Co-authored-by: zszz3 <zszz3@users.noreply.github.com>
2026-11-30 15:15:59 +08:00
zszz3
2026ee4f18 fix: keep per-session data out of capability system blocks 2026-11-29 16:32:47 +08:00
Rudy Mizrahi Celekli
df2d6f0b0b fix(reading): preserve original extensions on long multilingual filenames (#2780)
* fix(reading): fit original filenames within the UTF-8 limit

* fix(reading): shorten the temp upload name the same way

The upload is first written to a temp file named after the upload. A
100-character Chinese name is 300 UTF-8 bytes, so on Linux the request
failed with "File name too long" before the stored-name limit added
here was ever reached.

* chore(api): refresh router index for the reading upload change

---------

Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-28 20:26:37 +08:00
Bingxi Zhao (Frank)
2dcb44c6ed Merge PR #2574: fix(reading): anchor Markdown highlights in rendered-text space
Ground formatted Markdown quotes and context using the existing selection projection, require a grounded quote for browser-only positions, and reject fabricated selections (90 passed). Rendered math that cannot be verified remains conservatively rejected.
2026-11-14 23:15:17 +08:00
Bingxi Zhao (Frank)
fa3debf4b4 Merge PR #2560: fix(reading): keep quiz answer keys on the server 2026-11-14 22:58:53 +08:00
evan188199-tech
45b1a7e036 fix(reading): keep grounded vocabulary terms when siblings miss the selection (#2579)
Vocabulary help no longer rejects the whole card when one returned term
is absent from the selection: grounded terms are kept and unmatched
siblings are dropped. The ValueError is now raised only when every term
fails the grounding check, and the message lists the rejected terms so
503 bodies are diagnosable.
2026-11-10 07:31:43 +08:00
evan188199-tech
046a8eeb77 fix(reading): anchor web_markdown highlights in rendered-text space
Uploaded Markdown materials are rendered before display, and the browser
measures TextPositionSelectors against that rendered text — a coordinate
space the raw unit cannot reproduce (**bold** loses its asterisks, $x^2$
becomes KaTeX markup). Slicing the raw Markdown with those offsets made
save_annotation reject almost any selection after inline formatting with
"text quote and position selectors describe different text".

For web_markdown units, store positions as sent (the reader re-anchors
them against the same rendered text via quote plus prefix/suffix) and
validate the quote by occurrence in the raw unit, falling back to the
rendered wording when a selection crosses formatting or math. Plain-text
validation is unchanged, and the selector span ceiling still applies.

Validation: ruff check/format passed; pytest tests/reading passed
(477 passed, 1 pre-existing skip).
2026-11-09 23:57:44 +08:00
Yin
5d16a6a2f0 fix(reading): keep quiz answer keys on the server 2026-11-09 22:17:03 +08:00
AleFlyX
34c404228a fix(reading): keep document extraction off the API event loop
Immersive Reading extracts documents synchronously — an EPUB walks its whole
spine and a PDF renders every page through PyMuPDF — but the router called that
work directly from its async handlers. The API runs one event loop per worker,
so a document being opened or uploaded parked every other request: the session
title and transcript of the conversation being switched to, progress polling
and cancellation all waited behind the parse (#2054).

Run the upload extraction and the material detail build through
asyncio.to_thread, matching how the rest of this router and
capabilities/reading/tools.py already call the same store API.

Also load the outline once. _detail() read it, then render_outline() read it
again; for an EPUB whose stored rows still lack publisher anchors each read can
re-parse the whole package through _upgrade_epub_outline. Rendering is split
into format_outline(manifest, entries) so the rows already loaded are reused,
and render_outline() keeps its signature for existing callers.

Regenerated the router index fingerprint for the changed router source.
2026-11-01 00:58:00 +08:00
Bingxi Zhao (Frank)
cc9a60237b Merge remote-tracking branch 'origin/dev' into codex/land-2163
# Conflicts:
#	deeptutor/utils/document_extractor.py
2026-10-31 17:25:30 +08:00
Bingxi Zhao
6b971d89e6 Merge pull request #2225 from kevin9327/fix/reading-long-name-keeps-extension
fix(reading): keep the extension when a long material name is cut
2026-10-31 17:14:59 +08:00
Rimcat-JA
f75d44eb03 fix(reading): render uploaded Markdown files, including math
Uploaded .md / .markdown files were stored as plain_text, so immersive
reading showed their literal source and every formula stayed raw LaTeX.
Record them as web_markdown so they take the existing safe rich renderer
(KaTeX, no raw HTML). Images stay off for uploads, since their links can
point at any host; web snapshots keep their localized images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:12:08 +09:00
kevin9327
e65408d8c4 fix(reading): keep the extension when a long material name is cut 2026-10-31 12:14:46 +09:00
朱鸿儒
e51c25f726 fix(docx): preserve native OMML equation structure 2026-10-30 10:41:28 +08:00
Bingxi Zhao (Frank)
7cb31af807 fix: preserve module entry points in source installs 2026-10-28 01:37:28 +08:00
Bingxi Zhao
06443db9bc Merge pull request #1822 from dajiaohuang/fix/cron-connection-lifetime
fix(storage): close short-lived SQLite connections deterministically
2026-10-19 00:19:44 +08:00
Fancie-Personal
e7c909ec94 perf(documents): bound an inlined raster's long edge before admission
Chat attachments base64-inline every harvested image into one provider
request, and the byte budgets did not bound what a *page-sized* raster costs
there: a scanned A4 page arrives at ~2900x4032 (~600 KB), so a seven-page scan
rode along as ~4.2 MB of body / ~5.6 MB encoded even though the model is served
a raster scaled toward ~1.5k on the long edge anyway.

Fit a candidate to MAX_INLINE_IMAGE_EDGE (1600) before the byte budgets weigh
it, so the budgets measure what will actually ship. An image already within the
bound keeps its bytes and its format; re-encoding is reserved for rasters past
it, at the same jpg_quality (82) the reading viewport's whole-page render
already uses. Every failure path returns the original bytes, and a pixel count
past MAX_INLINE_FIT_PIXELS is refused before Pillow allocates for it.

The reading-area ingest keeps source resolution (max_inline_edge=0) because
those images are written to disk for the reader pane. The PPTX and DOCX
ingests were still on the chat-attachment budget by default, so they now pass
the reading budget like the PDF ingest already did.
2026-10-18 23:36:28 +08:00
dajiaohuang
149343c414 fix(storage): close SQLite connections after helper operations 2026-10-15 12:08:30 +08:00
Bingxi Zhao
a63851df5b Merge pull request #1942 from lorenzozanee/fix/epub-folder-drag-zip
fix(reading): accept browser-zipped EPUB folder uploads
2026-10-15 03:25:10 +08:00
lorenzozanee
981bd0e17f fix(reading): accept browser-zipped EPUB folder uploads 2026-10-13 02:40:11 +08:00
jiangbianshu
07cf021d34 fix(reading): accept video playback time in the reading viewport
Since Watching converged into Reading (#1378), the reader reports
`reading_viewport.time_seconds` with every turn on a video material, but
`ReadingViewport` forbids extra fields and only declared `locator` and
`selection`. The WebSocket rejected each such turn with `invalid_command`,
so every question asked beside a YouTube/Bilibili video stayed "Not sent".

- Declare `time_seconds` (optional, >= 0) on `ReadingViewport`.
- Keep it in `_reading_viewport` (finite, non-negative, capped at 24h) so
  the reading capability's existing "Current media time" grounding
  actually receives it instead of silently dropping it.
- Regenerate the frontend contracts.
- Cover protocol acceptance and normalisation in tests/reading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:43:20 +08:00
Bingxi Zhao (Frank)
ecdc146d13 fix(reading): keep Markdown pagination visible in narrow panels (#1641) 2026-10-08 00:10:24 +08:00
evan188199-tech
d81e1b2ea0 test(reading): cover the bilingual EPUB pairing pipeline edge cases (#1738)
* test(reading): cover the bilingual EPUB pairing pipeline edge cases

* style(reading): apply ruff format to bilingual EPUB unit tests

---------

Co-authored-by: XZH <cto@xzh.ai>
2026-10-07 20:13:02 +08:00
Bingxi Zhao (Frank)
8ccca47bac fix(reading): track EPUB text progress within chapters (#1673) 2026-10-04 18:20:29 +08:00
Bingxi Zhao
90d2d06366 Merge pull request #1655 from evan188199-tech/codex/feat/reading-natural-tts
feat(reading): add material-scoped natural read-aloud audio (#1654)
2026-10-04 15:04:37 +08:00
Bingxi Zhao (Frank)
895c41999c Merge dev into PR #1665 and preserve integrated behavior 2026-10-04 14:47:52 +08:00
Bingxi Zhao (Frank)
2700105923 Merge dev into PR #1664 and preserve integrated behavior 2026-10-04 14:41:40 +08:00
Bingxi Zhao (Frank)
dfeb2fb4f3 Merge dev into PR #1657 and preserve integrated behavior 2026-10-04 14:22:45 +08:00
Bingxi Zhao
891493b7b1 Merge pull request #1686 from evan188199-tech/codex/fix/epub-toc-anchors
fix(reading): preserve EPUB outline anchors (#1673)
2026-10-04 14:20:41 +08:00
XZH
95e913a787 fix(reading): preserve EPUB outline anchors 2026-10-01 17:26:44 -07:00
ZyPulse
1c07ef4e44 perf(parsing): cache image descriptions per workspace 2026-09-30 00:15:20 +08:00
ZyPulse
cbb742a141 feat(parsing): select an independent image description model 2026-09-30 00:01:29 +08:00
XZH
cd474bc824 feat(reading): add server-owned quiz star rewards (#1656) 2026-09-29 06:17:54 -07:00
XZH
eeb360f66a feat(reading): add material-scoped natural read-aloud audio (#1654) 2026-09-29 05:56:41 -07:00
Hui
6dd4542a0b fix(reading): close a Markdown fence only on a matching bare run
split_markdown_by_headings remembered only the fence character, so any
line starting with that character toggled the fence. A ```` fence showing
a ``` example closed at the inner ```, and a "```py" line inside a block
also closed it, so "#" lines inside code became outline sections, or the
rest of the document was swallowed and the outline fell back to flat.

Remember the whole opening run and close only on a bare run of the same
character that is at least as long, as CommonMark does. A backtick line
whose info string contains a backtick no longer opens a fence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 20:44:31 -04:00
Bingxi Zhao
b99a7d9026 Merge pull request #1576 from yizhang-dream/feat/reading-view-figure
feat(reading): let the reader look at any stored figure on demand
2026-09-27 03:21:56 +08:00
Bingxi Zhao (Frank)
842ed970e8 fix(reading): cite figure locations and cover vision fallback 2026-09-27 03:04:36 +08:00
NoxsMedia
b08833ed62 chore: merge upstream dev into markdown outline fix 2026-09-24 05:28:08 +00:00
flower-moon
e0e3e02663 feat(reading): let the reader look at any stored figure 2026-09-24 13:27:43 +08:00
Bingxi Zhao (Frank)
a053fecf6e release: v1.6.11
The interface ships in French and Ukrainian alongside English and
Chinese, and /language pins a reply language for one conversation.
Immersive reading organizes collections as colored folders, adds a
fullscreen learning mode, and turns Explain / Translate / Guide me on a
selection into ordinary messages in the reading chat; "Quiz me on this
page" runs one quiz turn without changing the conversation's mode, which
retires the reading-openers endpoint and its task model. Images embedded
in DOCX, PPTX and PDF are extracted in place and reach vision models.

Office files preview as paged PDFs through LibreOffice (now in the Docker
image), falling back to the in-browser renderers without it. Web sources
re-sync on a durable schedule, linked folders sync on demand, .bib files
index, and a zotero_search tool queries Zotero. Settings gains Learning
progress and credential-free presets; admins import users from CSV;
split deployments can hand a session to a public device. Grok CLI joins
the subagents, Unifically the providers, ChatGPT exports the importers.

Gate cleanup: mypy/bandit findings in the new launcher, audio-overview,
web-source, reading-store and textbook modules; the task-model copy test
follows the retired reading_openers kind.

See assets/releases/ver1-6-11.md for the full notes, and the README
Releases row plus its eleven translations.
2026-09-24 09:59:56 +08:00
NoxsMedia
4738ead451 fix: derive uploaded markdown outlines from headings 2026-09-24 01:49:16 +00:00
Bingxi Zhao (Frank)
53436f8190 feat(reading): collections as colored folders; rework reader interactions
Collections vs workspaces: a workspace holds many collections, and a
collection's files and reading conversations live in the workspace it
was created in. The library now shows collections as folders grouped
under their workspace, and creating one asks which workspace it goes
into.

- Folder page at /learning/reading/folders/[folderId]: breadcrumb,
  files, the collection's conversations, and "Start reading" that opens
  the whole folder in the reader. The reader's back link returns to it.
- Collections carry a user-picked color (new `color` column, migrated);
  tones are --folder-* tokens with dark variants.
- One shared "New collection" / "Edit collection" dialog with consistent
  type sizes.
- Selection popover gains AI actions; results land as cards at the foot
  of the companion. Read-aloud is a single header toggle.
- The three ⋯ menus (collection, document, conversation) merge into one.
- Outline toggle moves to the left and starts closed; navigator has
  Outline / Annotations tabs.
- Reading conversations live in the main sidebar (with a page-shaped idle
  mark) instead of a history dropdown in the companion.
- Fix sidebar rows never showing a selected state
  (bg-[var(--background)]/60 compiled to nothing).
- Composer floats over the conversation (no divider, bottom fade); the
  toolbar wraps by content instead of splitting under 420px.
2026-09-23 18:59:17 +08:00
Bingxi Zhao (Frank)
66ba712172 fix(reading): make selection actions reliable and sync reading sessions
- Strip PDF margin line numbers before verifying a selection, so explain
  and guide no longer fail with "Select text from the visible unit first".
- Quiz, vocabulary and study guidance go through
  json_with_reasoning_retry with a larger token budget; reasoning models
  exhausting max_tokens returned an empty answer that surfaced as
  "This reading action is temporarily unavailable" (503).
- Renaming or deleting a reading conversation from the main sidebar
  updates the reading catalog too.
2026-09-23 18:59:02 +08:00
Bingxi Zhao (Frank)
8880529c65 Merge PR batch with local follow-up fixes
Preserve precise learner KB route guards, combine UI and response language domains, carry normalized EPUB extraction, and regenerate frontend contracts.

Update locale fallback coverage for the completed Ukrainian translation bundle.
2026-09-23 12:01:14 +08:00
Bingxi Zhao (Frank)
55e96e429e style: satisfy repository lint and format gates 2026-09-23 11:28:41 +08:00
Bingxi Zhao (Frank)
705e9bf9d5 Merge branch 'codex/reading-learning-prs-20260923' into codex/pr-batch-root
# Conflicts:
#	deeptutor/reading/extract.py
#	deeptutor/reading/store.py
#	web/components/notebook/NotebookRecordRow.tsx
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-09-23 10:58:38 +08:00
Bingxi Zhao (Frank)
ce590620d7 Preserve reading source fidelity and resilient activity tracking 2026-09-23 10:54:37 +08:00