10 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
2ea5292f9f fix(visualize): inherit the application color scheme in HTML widgets
Local dev repairs for #2600.

Theme changes and explicit widget themes tested. Web typecheck, 1407 Node tests, eslint and i18n passed.
2026-11-15 00:50:31 +08:00
riccardo-algorime
1f82e309e8 fix(web): keep widget KaTeX's $$ delimiter and render math written after load
injectKaTeX inserted its init script with a string replacement, where "$$"
means "$". The display delimiter became "$", so `$$...$$` stayed raw and
every `$...$` rendered as display math. Replacer functions keep the script
as written.

Widgets often write math after load (step-by-step reveals, slider
readouts), which auto-render never saw. A throttled MutationObserver now
renders it, skipping math already rendered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 13:37:01 +00:00
Bingxi Zhao (Frank)
97574b5236 fix: three defects on the paths this week's PRs touched
Found by an adversarial pass over the merged changes.

**A tool call could run under another call's name and arguments.**
``_ToolCallBuffers.add`` registered every buffer under the placeholder
item id ``fc_0``, which providers that omit ``item.id`` all share, and
``response.output_item.done`` looked buffers up by that same placeholder.
A ``done`` event for a call that was never announced therefore resolved to
whichever unrelated call last claimed it. Reproduced: a second call to
``list_kb`` was dispatched as ``delete_kb`` carrying the first call's
``{"kb": "secret"}``. The placeholder is a display fallback, not an
identity — never alias it, never look up by it.

**A blocked CDN froze every HTML visualization.** The iframe height
bridge attached its observers on ``DOMContentLoaded``, but ``injectKaTeX``
adds deferred script tags, and deferred scripts must all run before that
event fires. With jsdelivr unreachable the observers never attached and
every visualization sat at its initial height. The bridge is injected just
before ``</body>``, so it can gate on ``document.body`` instead and attach
before the CDN fetch resolves.

**RAG citations dropped their sources.** ``_extract_rag_citation`` was the
only extractor not handed ``tool_metadata``; it re-parsed ``raw_answer``,
which is the prose shown to the model, not JSON. Every RAG pipeline
normalises its retrieval into ``metadata["sources"]`` — already the shape
``_rag_source_payload`` reads — so prefer it and keep the answer parse as
the fallback. This is the user-visible half of #808 that normalising the
payload alone did not restore.

Also hoist the Gemini "minimal, not none" families beside
``_PROVIDER_DEFAULT_OFF_PATTERNS``, whose docstring calls itself the single
source of truth for exactly this knowledge.
2026-08-12 17:28:56 +08:00
Bingxi Zhao (Frank)
456f9c2422 release: v1.5.11
What happens while the answer is still being written. Prose that shared a
round with a tool call vanished into the trace, a truncated generation read as
the model deciding it had finished, and local indexing sat on the event loop
everything else needed.

- DSML tool calls are stripped from the stream incrementally instead of
  all-or-nothing. Once a round's content channel showed markup, the rest of it
  was diverted to the thinking channel, so any prose around the call left the
  answer. DSMLStreamFilter suppresses only the envelope and the invoke blocks;
  text before, between and after streams and persists (turn_runtime carries
  answer_visible rounds into the assembled answer). An incomplete invoke is
  released verbatim by flush, and a 512-char ceiling stops a stray `<` in
  ordinary prose from making the live stream wait for a closing bracket.
- DSML parameter decoding consults the declared schema. DeepSeek marks
  essentially every parameter string="true", arrays and objects included, so a
  container argument reached the tool as a string of JSON. A parameter the
  schema types array/object is parsed when the payload actually matches; the
  provider's string contract still wins elsewhere. The catalog is kept when a
  provider rejects native `tools` and the loop falls back to DSML — exactly
  when the parser needs it.
- The round budget is three stages: exploration, a bounded settlement window
  (MAX_SETTLEMENT_ROUNDS, tools still available so an already-started
  interaction can finish), then one tool-less hard finish. A `length` finish is
  an incomplete generation, not a decision to stop: the visible prefix is kept
  and a continuation requested, under the same upper bound of exploration + 4.
- Resident memory across the process tree, at GET /api/v1/system/memory and in
  the settings strip. runtime/memory_probe.py walks the tree; psutil is
  imported lazily with a /proc fallback, so a missing wheel costs the strip and
  not the app, and non-admins get {available: false}. The strip drops
  LLM/Embedding/Search, which restated what the Models and Chat pages own.
- Local LightRAG indexing runs on a worker thread's own event loop.
  RAG-Anything's local backends do synchronous graph merging and JSON
  serialization inside async methods, stalling unrelated API and LLM work;
  OwnerLoopBridge forwards LLM, vision and embedding calls back to the
  request's loop with a copy of the caller's contextvars.
- Mastery works from the persisted question. learning/pending.py projects a
  PendingQuestion into the public contract (prompt, type, label/body map) with
  the expected answer server-side; ask_user renders that instead of display
  data the model re-authored, and registration validates the quiz shape rather
  than silently accepting a contradictory one.
- Connected KBs answer honestly about local files (empty listing, explicit 409
  where a local file is required) instead of resolving a raw/ directory that
  does not exist. resolve_public_output_path replaces is_public_output_path so
  the new request-scoped /api/outputs endpoint authorizes and resolves in one
  operation and fails closed with no request user. Visualize iframes measure
  body content so they shrink as well as grow, and the chat page's model list
  is fetched once behind a single-flight hook.

test_forced_finish_still_reports_the_tools_the_turn_carried asserted the old
two-stage budget (exhausted exploration = the next call is the tool-less
finish); it now drives through settlement to reach the real hard finish. Also
syncs the README prose, all ten translations, and the release-notes archive.
2026-08-10 00:47:37 +08:00
Bingxi Zhao (Frank)
7009f7a988 fix 2026-08-09 22:18:22 +08:00
Bingxi Zhao (Frank)
452de66729 release: v1.4.3 — TutorBot→Partners, single-loop Chat, real multi-user isolation
The biggest cut since v1.4.0:

- Partners: TutorBot renamed and rebuilt on the product chat agent loop —
  production IM pipeline (retry/dedup/coalescing, per-channel delivery),
  live streaming on Telegram/Discord/Feishu, new WeCom AI Bot channel
  (15 connectors), web-chat attachments, soul template library + editor.
  Automatic non-destructive migration from data/tutorbot/; HTTP API moved
  to /api/v1/partners.
- Chat: single exploring agent loop with native tool calling; Activity
  header with collapsible thinking/tool trace.
- Multi-user: per-user grants v2 (tools/MCP/exec), data/users + data/system
  layout with automatic migration, runner mounts only the user workspace.
- Visualize: inline themed SVG, structured prompts, local validate+repair
  replacing the LLM review round.
- Co-writer Mermaid diagrams + selection RAG/web; file viewer docx/xlsx
  previews; MinerU cloud parsing backend; office skills on by default;
  CLI chat renderer rewrite.
- Docs rebuilt at deeptutor.info: per-channel setup guides (en+zh),
  refreshed screenshots.
- Pre-commit clean sweep: defusedxml for SVG validation, usedforsecurity
  flags on content hashes, mypy fixes, types-croniter stub.

Release notes: assets/releases/ver1-4-3.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 17:17:43 +08:00
Bingxi Zhao (Frank)
b499ba7aaf feat(visualize): inline + themed SVG rendering, html sendPrompt bridge
- SvgRenderer: <img> data-URI -> sanitized inline DOM. Dependency-free
  sanitizeSvg strips script/foreignObject/on*/js-urls and scopes element ids +
  url()/href/aria refs so multiple inlined svgs don't collide. Multi-<svg>
  content is split into independent figures.
- svg-theme.css: themed class system (t/ts/th, box/node/arr, c-* 9-ramp)
  following light/dark via CSS vars and the app Geist font; svg sized width:100%
  by viewBox to avoid the 300x150 inline collapse.
- HtmlRenderer: iframe height auto-fit + receives the widget's sendPrompt.
- iframe-html.ts: inject the sendPrompt bridge + a ResizeObserver height report.

Frontend visualize only — the chat page.tsx composer-prefill listener is left in
the working tree alongside the unrelated chat changes there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 22:33:16 +08:00
Bingxi Zhao (Frank)
90a2c14c81 chore: backend + frontend follow-ons for v1.4.0-beta
Wires the new memory / capability / settings / quiz subsystems into
existing surfaces and finishes the chat-pipeline follow-on work.

Backend:
- Session services pick up the cumulative source inventory + new tool
  tags (turn_runtime, sqlite_store, pocketbase_store, protocol,
  base_session_manager).
- LlamaIndex RAG pipeline config / document_loader / retrievers
  tightened; rag/service.py routed to match.
- Sessions / unified_ws / settings / notebook routers updated for
  delete-chat-turn, multi-user, and the new tool surface.
- TutorBot manager + Zulip channel + openai_compat_provider follow-on
  fixes layered on top of the v1.3.10 SSL/Zulip sweeps.
- runtime/{banner, launcher, orchestrator}, services/setup/init,
  prompt/manager, json_parser refined for the runtime-settings
  rewrite.

Frontend:
- Co-Learn pages and session-surfaces removed (folded into chat).
- Chat composer / messages / trace / session panels, sidebars,
  common modals, markdown renderers, and i18n updated for the new
  ask_user / write_note / source-inventory flow.
- Admin, agents, co-writer, playground, book pages picked up the
  shared updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:08:22 +08:00
Bingxi Zhao (Frank)
77f29cbcc7 fix lint 2026-04-23 19:29:16 +08:00
Bingxi Zhao (Frank)
2745e8bde9 feat(book): introduce book capability and restructure guide/co_writer modules
- Add new `deeptutor/book/` module with multi-agent pipeline
  (ideation, spine, page planner, source explorer, synthesizer)
  and rich block system (text, code, figure, quiz, flash cards,
  callout, deep dive, timeline, animation, concept graph, etc.)
- Add `/api/routers/book.py` and `deeptutor_cli/book.py` entry points
- Add web UI under `web/app/(workspace)/book/` with sidebar,
  chat panel, page reader, spine editor, progress timeline, and
  block renderers
- Move `deeptutor/agents/co_writer` -> `deeptutor/co_writer` and
  `deeptutor/agents/guide` -> `deeptutor/guide` (then remove guide
  entirely now superseded by book)
- Remove legacy guide UI, hooks, types, and API router
- Update visualize agents/prompts, notebook service, prompt manager,
  session turn runtime, and shared services to support new flows
- Refresh chat composer, sidebar, notebook selector, and locales

Made-with: Cursor
2026-04-20 00:33:33 +08:00