Commit Graph

4217 Commits

Author SHA1 Message Date
Carl
c1ae1bbe2a fix(rag): isolate LlamaIndex cross-encoder reranker in a worker process (#3005) 2026-11-30 14:17:26 +08:00
Qiu
3e66b30aa0 fix(chat): isolate PDF attachment extraction (#3026)
* fix(chat): isolate PDF attachment extraction

Run PDF-bearing chat attachment extraction outside the API process and reuse the single PDF image pass for both page markers and embedded attachments. Addresses the chat attachment reproduction in #2865.

* perf(pdf): skip decoding images after the count cap

Keep lookups for previously accepted image references ahead of the quota check so repeated pictures are still mapped to each page.

* perf(chat): reuse native PDF markdown for text-only parsing

Match the stored attachment bytes and preserve the configured parser path for other engines and incomplete native results.
2026-11-30 13:56:01 +08:00
Marcello Pichini
6b00f0109c fix: combine adjacent minute and second duration units (#2684) 2026-11-30 11:32:40 +08:00
Chen jizhou
79a66cb3c1 perf: stop idle activity orbs and narrow theme observers (#2704) 2026-11-30 11:12:41 +08:00
bluefateludi
4277138581 perf(auth): format only the requested account for profile lookups (#3033) 2026-11-30 11:12:32 +08:00
1zrj
24aa2632d9 fix learning activity (ReadingCompanion, MasteryStudy, NoteCompanion) chat auto-follow (#2935) 2026-11-30 11:12:23 +08:00
Benjamin Schwing
15489b72cf fix(question): read an uploaded exam paper back from the attachment store (#2949)
Mimic mode never parsed a paper uploaded from the web composer. The turn
executor stores every upload in the attachment store and then clears the
inline base64 of each document it has extracted, so the PDF attachment
reached DeepQuestionCapability with an empty base64. The upload branch was
skipped and the turn fell back to the plain-text "[Attached Documents]"
hint: no exam parsing, no question extraction and no templates.

When the attachment carries no inline bytes, the capability now resolves
the stored file by session and attachment id, the same lookup the chat PDF
parser uses, and parses it as before. Inline base64 is still used when
present.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-30 11:12:14 +08:00
Alex Castillo González
218dbe31b9 fix(mastery): document observation-only fields in the teaching_updates schema (#2872)
TeachingUpdate.model_json_schema() gave knowledge_point_id, strategy and outcome no description, so models filling a preference also set strategy and the call is rejected by check_semantics. Add per-field descriptions (flat schema kept) and a test.
2026-11-30 01:42:44 +08:00
AleFlyX
633ca7656f Merge PR #2999: fix(embedding): keep transport retries independent of rate-limit retries
A read timeout after repeated HTTP 429s still gets a transport retry at the normal initial backoff. All 193 embedding tests passed.
2026-11-29 22:56:32 +08:00
AleFlyX
be2fe9104d Merge PR #2837: fix(rag): batch LlamaIndex rebuild checkpoints
Batch resumable embedding checkpoints and write the BM25 sidecar once after the final checkpoint, carrying over #2903. 45 targeted tests passed with the PR applied to dev. A 19-source rebuild retrieved the last source from the persisted BM25 index.
2026-11-29 16:32:15 +08:00
lytanjie
ab51601b89 fix(web): keep statistics notation as inline math (#2878)
* fix(web): keep statistics notation as inline math

plausibleMathBody judged inline math by Latin words, so $Var(N)$, $Cov(X,Y)
and $Corr(X,Y)$ fell through escapeStrayDollars and displayed as source.
Add the common statistics functions to MATH_WORDS.

Also recover control characters left by JSON tool-argument decoding
(U+0008/U+000C/U+000D followed by a letter) back into \b, \f and \r, so
formulas already stored in notes render again.

Tests: latex-normalize.test.ts.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(web): only restore a decoded escape that spells a KaTeX command

A form feed or carriage return in front of a word is not always a mangled
\frac or \right: text extracted from a PDF keeps a form feed between pages.
Rewriting every one of them showed a stray "\f" in front of the next word.
Restore the backslash only when the letters after it name a KaTeX command.

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-29 15:29:03 +08:00
Zhuoran Wang
3ce3d47858 Fix quiz-attempt 500 when the Book entity has no chat_session_id (#2692)
* Fix quiz-attempt 500 when the Book entity has no chat_session_id

book.py's attempt sync read book.chat_session_id, an attribute that only
exists on CreateBookRequest/BookInputs (a legacy creation-time shorthand)
and is not persisted on the Book model — so every quiz attempt without a
page-bound chat session raised AttributeError after the progress was
saved, returning 500 and dropping the Focus-Check assessment sync.

Read only the persisted per-page mapping, and cover it with a regression
test whose fake mirrors the real entity (no chat_session_id attribute).

* style: apply ruff format

* chore(api): refresh router index for the book router

---------

Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-29 15:28:55 +08:00
lytanjie
305eb7bf75 fix: parse inline math in note tables and statistics notation (#2737)
* fix: parse inline math in note tables and statistics notation

BlockNote only renders `inlineMath` nodes, and two common shapes never
became one:

- `parseNoteMarkdown` converted inline `$...$` in a block's top-level
  content, but table cells live under `tableContent.rows`, which the walk
  never reached.
- The normaliser treated `$Var(N)$` and `$Cov(X, Y)$` as prose because the
  Latin-word heuristic did not recognise statistics function names, so it
  escaped the delimiters as stray dollars.

Recurse into `tableContent` cells and add the common statistics function
names to the math-word allowlist, with regression tests for both.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(web): count statistics names as maths only when they are called

"mean", "median", "rank", "span" and "var" are English words and a
keyword too, so with them in the word list "$52k mean, $48k median" became a
formula and a backticked `var x = 1` on a page with maths turned into KaTeX.
Keep them out of MATH_WORDS and accept them only before "(", which is how
Var(X) and Cov(X, Y) are written.

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-29 15:11:07 +08:00
lytanjie
284e06145d fix(web): render GFM tables in learner card stems (#2879)
Learner-card stems go through InlineMarkdown, which only switches to the
rich renderer for math, emphasis, code and links; a stem whose only markup
was a table reached the learner as raw pipes. Detect GFM tables and route
those stems through RichInlineMarkdown, and add markdown-table.ts (table
detection plus a blank line after each table so a trailing sentence is not
swallowed as another row).

Tests: learner-card-table.spec.tsx, markdown-table.test.ts.

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-11-29 14:53:07 +08:00
lytanjie
cf03cebdcb fix(web): split display fences that hug a matrix environment (#2880)
processLatexContent now runs normalizeEditorMdInlineMath, so a stem written
as $$P=\begin{pmatrix}...\end{pmatrix}$$ gets each $$ on its own line.
remark-math otherwise parses it as inline math and KaTeX fails on the first
ampersand or row break.

Tests: latex.test.ts, learner-card-math.spec.tsx.

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-11-29 14:52:50 +08:00
欧八同学
a345d44aef fix: remember the selected consult partner per chat (#2775) 2026-11-29 14:52:34 +08:00
Benjamin Schwing
648443b5dd fix(chat): don't open the quiz settings sheet when a quiz session loads (#2950)
* fix(chat): open quiz settings only when the learner picks the mode

The Activity panel auto-open watched the active capability, so loading or
reloading a session that was already in Quiz / Visualize / Research mode
counted as a switch into that mode. On a phone the panel is a full-screen
sheet, so every reopened quiz session started covered by its settings.

Open the config card from handleSelectCapability instead, the only path
for an explicit mode change (composer picker, slash command, launch
intent). Session hydration no longer opens it; restored per-session
settings are untouched.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>

* test(chat): record viewer panel props through a spy

Assigning to the hoisted fixture inside the forwardRef stub trips
react-hooks/immutability; capture the props with a mock call instead.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>

* fix(quiz): translate question badges and the German mimic label

The quiz card header printed the raw question type (short_answer,
fill_in_blank) and difficulty ids instead of the labels the quiz
settings already use, and the German catalog left "Mimic Paper"
untranslated.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>

---------

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-29 14:52:18 +08:00
mocias
23189ca690 fix(reading): keep Invidious picker controls inside its dialog (#3025) 2026-11-29 14:52:01 +08:00
Antonio-Faure
2df7cd1958 fix(web): center the new-partner wizard content (#2856)
The step body and footer capped themselves at max-w-2xl but stayed at the
left edge of the 1180px page container, leaving a wide empty column on the
right. Other partner surfaces (archives, chat) already center their
max-w-2xl column. Wrap the step header and body in a centered max-w-2xl
column and center the Back/Next row with it.

Layout-only change.

Co-authored-by: Antonio-Faure <209759495+Antonio-Faure@users.noreply.github.com>
2026-11-29 14:51:44 +08:00
欧八同学
5a1bd72ca2 fix: give the glass session viewer an opaque background (#2774) 2026-11-29 14:51:27 +08:00
Leoy
566465dc42 fix(mastery): ignore knowledge-base sources that no longer resolve (#2752)
* fix(mastery): ignore knowledge-base sources that no longer resolve

Refs #2748

* fix(mastery): filter the caller's mounted knowledge bases too

A study session left open across a deletion keeps sending the base it was
mounted with, and that list is merged verbatim with the topic's sources.
Run both through knowledge_base_ref_available so a stale name cannot reach
the tool bundles and raise AccessError.
2026-11-29 14:49:40 +08:00
Bingxi Zhao (Frank)
02b94669c7 ci(labeler): mirror requested reviewers into assignees on PRs 2026-11-28 13:01:20 -05:00
Qiu
506cea9d4f feat(desktop): finish Windows chat file actions (#3051)
Continues #2978 and closes #2887. Includes the original Windows file actions, integrates the changes with dev, and adds an explicit default-app action.

Co-authored-by: Botong Wu <2048400180@qq.com>
2026-11-28 13:09:15 -03:00
sriv144
83c98d5983 fix: isolate invalid UTF-8 partner records (#3039)
Co-authored-by: sriv144 <180610320+sriv144@users.noreply.github.com>
2026-11-28 12:29:58 -03:00
Carl
0b93ddd697 fix: use canonical npmjs.org URLs in web/package-lock.json (#3004) 2026-11-28 12:29:35 -03:00
Qiu
8c475445d2 fix(web): render bare scripted math in quiz prose (#2808)
* fix: render bare scripted math in quiz prose

* fix(web): recover quiz subscripts parsed as emphasis

Adjacent bare formulas can share Markdown emphasis delimiters. Mask candidate underscores only while locating prose ranges, then wrap the original symbols for KaTeX. Cover the reported circuit options through all three rendering routes.
2026-11-28 21:03:56 +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
qiuqianyi66
32acc5889a fix(settings): answer 404 for unknown connection-test run ids (#2841)
* fix(settings): answer 404 for unknown connection-test run ids

* chore(api): refresh router index for the settings route change

tests/api/test_router_loader.py::test_repository_index_matches_router_sources
checks the fingerprint of router sources; regenerated with
scripts/build_router_index.py.

---------

Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-28 20:05:55 +08:00
Leoy
d8f678d04f fix(config): keep a settings document that cannot be parsed instead of resetting it (#2929)
* fix(config): keep a settings document that cannot be parsed instead of resetting it

* fix(config): re-warn about an unparseable settings document once a minute

The startup load runs before logging is configured, so its only record can
reach just the process output, and the permanent per-path set meant it never
appeared in the application log afterwards. Throttle per path instead, and
state in the containerization guide where the warning is written and that
the loader only preserves documents it cannot parse.
2026-11-28 19:42:21 +08:00
Alex Castillo González
1137a51aff fix: resolve ConfigManager settings from the runtime home (#2773) 2026-11-28 19:42:14 +08:00
Marcello Pichini
1d58192df2 fix(utils): expand BibTeX @string abbreviations in later fields (#2751)
@string blocks were skipped, so a field written as journal=jname kept the bare
macro name in the generated Markdown. Collect the definitions while scanning and
expand bare words that name one; unknown words and numbers are left unchanged.
2026-11-28 19:42:08 +08:00
Marcello Pichini
05188b51e0 fix(storage): shorten attachment names that exceed the filesystem limit (#2750)
The stored name is "<attachment_id>_<filename>", so a valid 240-byte filename
exceeded the 255-byte component limit and put() raised ENAMETOOLONG. Trim the
stem by bytes, keeping a short extension, so saving and lookup stay consistent.
2026-11-28 19:42:02 +08:00
Marcello Pichini
5901993bcb fix(tools): resume read_file after the last line shown (#2850)
When the numbered page exceeded the 128k-character budget, read_file cut
the text mid-page but still reported the requested range: the hint
pointed past lines that were never shown, or claimed the end of the
file. Stop at the last whole line that fits and base the continuation
offset on it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 19:41:54 +08:00
Yuchuan He
30a5e5cea5 fix: isolate malformed notebook data during recovery (#2956) 2026-11-28 19:41:47 +08:00
Yuchuan He
5a1722b80f fix: preserve embedded fences in book Markdown export (#2957) 2026-11-28 19:41:41 +08:00
bluefateludi
934a1922d3 fix: skip chart sheets when extracting XLSX text (#2960) 2026-11-28 19:41:34 +08:00
Qiu
6d0183d6f3 Merge pull request #2915 from Qiuner/mobile/react-native
feat(mobile): scaffold React Native chat client
2026-11-28 08:12:24 -03:00
LIziak112
ad355f454e feat(desktop): sync Windows menu preferences with web settings (#2971)
* feat(desktop): sync Windows menu preferences with web settings

* fix(settings): reconcile desktop preferences after updating the live baseline

* fix(desktop): guard menu zoom handlers against missing web view
2026-11-28 08:07:22 -03:00
crimson-gzx
b0e78d083d fix(loop): surface provider errors when forced-finish salvage fails (#2825)
Co-authored-by: Josh Guo <crimsongzx@gmail.com>
2026-11-28 18:24:39 +08:00
Gaurav Dubey
d5637d5ba3 fix(mastery): keep language-course content in its target language (#2934)
* fix(mastery): keep language-course content in its target language

The reply-language directive is the last thing in every system prompt and
tells the model to write quiz stems and options in the reply language and
never switch. For a course whose subject is itself a language, the model
obeyed literally: an "Antonyms" objective in an English course, studied with
Chinese as the reply language, was drafted as 反义词 and taught in a later
session as Chinese antonyms.

- language_directive now says the reply language governs the explanation,
  not the subject: a studied language keeps its own words, sentences and
  exercise items.
- Route generation and the tutor's outline drafting name the target
  language in every module and knowledge point ("English antonyms").
- The tutor playbook keeps an existing language course on its target
  language even when an objective name does not repeat it.

Closes #2933

Co-Authored-By: Claude <noreply@anthropic.com>

* test(mastery): check the composed prompts keep a language course's target language

The strict reply-language directive is appended last, after the route and
tutor instructions. Assert the carve-out survives in the prompts the model
actually receives: zh route generation, and the zh tutor playbook rendered
with a fixed reply language.

Related to #2933

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 18:24:23 +08:00
Benjamin Schwing
7938c6f40c fix(mastery): accept retained archive ids in tutoring memory coverage (#2947)
The fold prompt lets memory entries cite previously retained archive IDs,
but covered_archive_ids had to equal the newly supplied set exactly. A
model that also lists retained IDs as covered failed every fold, so the
watermark never moved and the session stayed on degraded raw history.

Accept covered IDs that are the newly supplied ones plus IDs the prior
memory already covered or cited. Still reject omitted, invented or unseen
IDs, and store only the newly folded IDs as covered.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-28 18:24:06 +08:00
Chih-Kai Wang
1d8be0ddf7 fix(mastery): bind settlement_recovery to lesson_evidence_id instead of path version (#2869)
Co-authored-by: f0909172434 <290806361+f0909172434@users.noreply.github.com>
2026-11-28 18:23:50 +08:00
Chen jizhou
4d4a0b7524 fix: preserve embedding checkpoint pointer across preflight failures (#2698)
Co-authored-by: chen-12-03 <184723954+chen-12-03@users.noreply.github.com>
2026-11-28 18:23:30 +08:00
iQuantum
88f38c02bf fix(learning): read the index each knowledge base's provider publishes (#2898)
Mastery Path preparation looked up a knowledge base's index by the global embedding signature. PageIndex, GraphRAG and LightRAG versions carry a provider signature instead, and a LlamaIndex knowledge base can be bound to another embedding, so a ready index was rejected with 'no compatible completed index'. Preparation now resolves the index the way the provider reads it: the KB's bound embedding for LlamaIndex, the newest provider-ready version otherwise. Fixes #2895.
2026-11-28 18:23:13 +08:00
lipeh1
803c4a4a35 fix: preserve empty reasoning in quiz tool continuations (#2800)
* fix: preserve empty reasoning in quiz tool continuations

* test: cover empty reasoning in assistant tool messages

---------

Co-authored-by: lipeih <lipeihan@eazytec.com>
2026-11-28 18:22:57 +08:00
Chih-Kai Wang
fa39a79e2f fix(mastery): stop same-turn mastery_grade retry loop on unreadable choice (#2866)
Co-authored-by: f0909172434 <290806361+f0909172434@users.noreply.github.com>
2026-11-28 18:22:21 +08:00
greenhand-fjm
ffda598f01 fix(setup): require qualified model/engine terms for setup intent (#2986)
Bare 'model', 'engine', 'embedding' and 'vector' are everyday words in a tutoring product (physical models, ML models, word embeddings). A learning question such as '把理想气体模型换成范德瓦尔斯模型,熵的表达式要怎么调整' matched an action word plus one of them, mounted the setup capability, and rewrote the system prompt and tool list mid-conversation. Only qualified forms (language/chat/embedding model, parsing/search engine) now count as a configuration object.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 18:21:11 +08:00
游标卡尺
cac05140f5 fix(mastery): name the recovery action for mis-scoped evidence (#2854)
* fix(mastery): name the recovery step when assessment evidence is mis-scoped

The focused-teaching refusal that blocks mastery_assess said only to prepare
assessment-bound evidence, so a session that had only ever prepared focused
packets retried the same call and the learner stayed stuck. Point the refusal
at the preparation that actually clears the gate.

* fix(mastery): avoid misleading recovery for incomplete evidence

Split focus-scoped and incomplete objective-scoped assessment refusals so
only focused packets are told to prepare without a focus. Surface missing
coverage for incomplete objective packets and pin the diagnostic with a
regression test.

---------

Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-11-28 18:17:47 +08:00
zzzworm
9c6a96c2d3 fix(video): align scene narration and fit diagrams (#3014)
* fix(video): align scene narration and fit diagrams

- Refine bilingual prompts for scene-by-scene narration and visuals
- Fit and center SVG diagrams with their labels and strokes
- Improve geometry coordinate guidance and preserve layout retries

* fix(video): do not report a fitted scene graphic as overflow

The kit scales a graphic with a transform on its full-size frame, so the
scaled frame box and the SVG canvas can exceed the region while the drawing
fits. Measure HTML overflow without that transform and canvas.

---------

Co-authored-by: zzzworm <15828873+zzzworm86@user.noreply.gitee.com>
Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-28 13:51:06 +08:00
Botong
5f4d878735 fix: 将预读附件全文放在来源清单之前 (#3006)
* fix: 将预读附件全文放在来源清单之前

* fix(explore): tell the model the preloaded text needs no read_source

Without the note the model re-reads the preloaded lecture with read_source on
the upload turn, sending the whole text a second time.

---------

Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
2026-11-28 13:51:00 +08:00