126 Commits

Author SHA1 Message Date
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
Bingxi Zhao (Frank)
100576da69 release: v1.1.2 — schema-driven channels, secret masking, RAG simplification, KB-consistency hardening
* TutorBot Channels tab is now schema-driven across every built-in & plugin channel
  (GET /api/v1/tutorbot/channels/schema), with per-field secret reveal toggles.
* Channel secrets are masked end-to-end; raw values only surface via the explicit
  ?include_secrets=true edit-form route. PATCH validates ChannelsConfig at the API
  boundary and returns 422 on bad payloads. reload_channels is serialised by an
  asyncio.Lock and records last_reload_error for the UI.
* Collapsed services/rag/ to a single LlamaIndex pipeline: removed ~2.6k lines of
  unused components/* + pipeline.py + types.py + utils/ + parsers/. rag_provider
  is now a stub; legacy values silently coerce to llamaindex.
* Centralised file routing into services/rag/file_routing.py (FileTypeRouter /
  DocumentType / FileClassification); dropped per-provider extension helpers.
* Defensive RAG/KB consistency: deep_solve / deep_research strip rag/kb when no
  KB is attached; SolveToolRuntime + ResearchPipeline + DecomposeAgent
  short-circuit instead of falling back to non-existent default KBs (DE-all,
  ai_textbook).
* Externalised AgenticChatPipeline prompts into agentic_chat.yaml (zh + en).
* Added Thai README (#337).
* New test modules: file_routing, knowledge_base_config, channel_schema,
  channel_secrets, rag_consistency, research_pipeline_rag.

Full notes: assets/releases/ver1-1-2.md

Made-with: Cursor
2026-04-18 11:33:53 +08:00
Srinivas R Kulkarni
0166009c0b feat(tutorbot): Channels tab, Telegram UI, API channel reload, token reveal (#338)
- Return full channels on GET /tutorbot/{id}; keep list view as channel names only
- PATCH bot when stopped (disk config); PATCH running applies channels + hot-reload listeners
- Add Channels tab: delivery toggles, Telegram fields, merge-safe save, show/hide token
- Extend tutorbot router tests (GET stopped, PATCH stopped/running + reload)
2026-04-18 10:36:45 +08:00
Bingxi Zhao (Frank)
4ef783066c feat(answer-now): per-capability fast paths instead of forced chat reroute
Each capability now owns its own answer-now branch so the early-exit
respects the capability's natural output shape:

- chat            -> synthesize markdown answer (existing behavior)
- deep_solve      -> skip planning + reasoning, jump to writer
- deep_question   -> skip ideation, emit full quiz JSON in one structured call
- deep_research   -> skip rephrase/decompose/research, write report directly
- math_animator   -> skip analysis/design/summary, KEEP code-gen + render
- visualize       -> skip analysis/review, emit renderable code in one call

The orchestrator no longer rewrites answer_now turns into chat. It now
preserves active_capability and only falls back to chat when the
originally selected capability is missing from the registry.

Shared plumbing lives in deeptutor/capabilities/_answer_now.py
(extract gate, trace summary formatter, skip notice, LLM stream
wrapper, chunk joiner). Each fast-path preserves the same result
envelope so QuizViewer / MathAnimatorViewer / VisualizationViewer
render unchanged, and prepends a "Skipped X stage(s)" notice so the
user knows it was a best-effort early exit.

Frontend: handleAnswerNow no longer overrides snapshot.capability.

Tests: rewrote the orchestrator routing tests for the new contract;
added tests/capabilities/test_answer_now.py with 28 cases covering
the helpers and every per-capability fast-path (including unparseable
JSON / invalid render_type / fence-wrapped JSON recovery, and a
math_animator test that verifies analysis/design/summary are NOT
invoked while code-gen + render ARE).

Updated v1.1.1 release notes to reflect the new design.

Made-with: Cursor
2026-04-17 23:32:45 +08:00
Bingxi Zhao (Frank)
e8aa57d737 release: v1.1.1 — universal answer-now, co-writer scroll sync, notebook system unification, tutorbot config refactor
- Promote "Answer now" to a universal escape hatch via answer_now_context;
  orchestrator re-routes any capability to chat._stage_answer_now.
- Co-Writer: draggable split + persistent ratio + line-anchored
  bidirectional scroll sync using a hidden mirror for wrap-aware editor y.
- SaveToNotebookModal: optional message-selection mode with quick presets;
  rebuild transcript / userQuery from the selected subset.
- Adopt the real notebook API (/api/v1/notebook/*) across Knowledge tab,
  guide notebook picker, and save-to-notebook flow; new typed helpers in
  web/lib/notebook-api.ts (listNotebooks/getNotebook/createNotebook/...).
- Extract CollapsibleConfigSection; unify Quiz / Math Animator / Visualize
  / Deep Research panels behind one collapsed-summary header.
- Replace streaming spinner with a dedicated Stop button; persistent
  composer header; mask-gradient on messages container.
- TutorBotManager: public load/save/merge API; atomic write via temp +
  Path.replace; merge_bot_config with explicit-clear semantics; new
  tests/services/tutorbot/test_manager_config.py.
- MarkdownRenderer: trackSourceLines passes data-source-line through;
  RichCodeBlock skips Prism for unlabeled/plaintext fences; mermaid
  detection includes flow/seq/sequence editor.md fences.
- UI/theme: deeper foregrounds + warmer borders for light/Snow themes;
  /guide migrated off hardcoded slate/indigo to design tokens;
  HistorySessionPicker themed and timestamp-seconds bug fixed.
- Filter system messages out of UnifiedChatContext.hydrateMessages and
  ChatMessageList so backend grounding context never renders as a bubble.
- Bug fixes (already merged earlier in dev):
  * tutorbot config wipe on restart (#332)
  * selective_access_log middleware unpack crash (#334/#335)
  * 15 npm security vulnerabilities — jspdf/next/mermaid (#330)
- Drive-by: remove "// README" typo from .env.example_CN.
- Add v1.1.1 release notes and update README.

Made-with: Cursor
2026-04-17 22:43:52 +08:00
Srini
d883751cb6 fix(web): resolve 15 npm security vulnerabilities
Bumped vulnerable direct dependencies:
- jspdf ^4.0.0 → ^4.2.0: fixes critical PDF injection, XSS, and DoS (9 CVEs)
- next ^16.1.1 → ^16.2.3: fixes HTTP smuggling, CSRF bypass, and DoS (8 CVEs)
- mermaid ^11.12.2 → ^11.14.0: fixes moderate DOMPurify/parser issues
- eslint-config-next 16.1.1 → 16.2.3: kept in sync with next

Ran `npm audit fix` to patch indirect dependencies:
- flatted: prototype pollution + DoS
- lodash-es: prototype pollution + code injection
- minimatch, picomatch: ReDoS
- dompurify, ajv, brace-expansion: moderate issues

Result: 0 vulnerabilities (was 1 critical, 5 high, 9 moderate)
No breaking changes — all updates are within the same major version.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:33:54 -07:00
Bingxi Zhao (Frank)
727d49cf8b release: v1.1.0 — LaTeX parsing overhaul, LLM probe config, extra_headers fix, notebook UUID fix
- Rewrite LaTeX block math normalization with heuristic-based $→$$ promotion
- Move LLM diagnostic probe max_tokens from env var to agents.yaml
- Fix extra_headers merge in LLM factory complete/stream (prevents TypeError)
- Fix SaveToNotebookModal to use notebook UUIDs instead of category IDs (#301)
- Add Docker + local LLM (host.docker.internal) guidance in env/compose files
- Add tests: LaTeX, notebook router, summarize agent, LLM probe, extra_headers
- Add v1.1.0 release notes and update README

Made-with: Cursor
2026-04-15 02:15:19 +08:00
sagnikonly
a2808cf7be fix(web): improve robust parsing for LaTeX block math 2026-04-14 20:52:20 +05:30
Bingxi Zhao (Frank)
9544075d60 v1.1.0-beta
URL-based chat routing, Snow theme, WebSocket heartbeat & auto-reconnect,
ChatComposer perf optimization, embedding provider registry overhaul,
Serper search provider, streaming idle timeout, and expanded test suite.

Made-with: Cursor
2026-04-14 22:11:48 +08:00
jiakeboge
5f0553e3e9 perf(web): fix severe input lag in long conversations (#317)
- Memoize ChatMessageList, UserMessage, and ReferenceChips components.
- Stabilize onRetryMessage callback using useCallback in HomePage.
- Prevent unnecessary re-renders of the entire message history during text input.
2026-04-14 20:10:08 +08:00
Bingxi Zhao (Frank)
8659d996f5 v1.0.3
Question Notebook with bookmarks & categories, Mermaid diagram support
in Visualize, embedding mismatch detection refinement, system message
merging for Qwen/vLLM, LM Studio & llama.cpp providers, Glass theme,
reporting agent retry resilience, and docs migration.

Made-with: Cursor
2026-04-13 03:18:26 +08:00
cskwork
95b0609605 feat: add wrong-answer note for cross-session quiz review
Persist structured quiz mistakes on submission and expose them in a
new review page accessible from the utility sidebar.

Backend:
- New wrong_answers SQLite table (cascade on session delete) with
  add/list/count/update/delete store methods
- Hook POST /api/v1/sessions/{id}/quiz-results to also insert one row
  per incorrect answer, preserving the existing [Quiz Performance]
  text message consumed by the LLM context builder
- New GET /api/v1/wrong-answers (resolved filter + pagination),
  PATCH /{id} (resolved toggle), DELETE /{id}

Frontend:
- New /wrong-answers page under the (utility) route group with
  unresolved/all filter, mark-as-resolved, delete, and session link
- Sidebar nav entry using the NotebookPen icon
- English and Chinese i18n strings for all new UI text

Tests:
- 8 store tests covering filter, cascade, resolved toggle, delete
- 6 router tests including a regression test that record_quiz_results
  still writes the [Quiz Performance] text message
2026-04-12 00:40:06 +09:00
Bingxi Zhao (Frank)
2734f481d1 fix: resolve Docker build type error in setTimeout return type
Use `setTimeout` instead of `window.setTimeout` to match the
`ReturnType<typeof setTimeout>` generic in retryTimersRef, fixing
the "number is not assignable to Timeout" compilation error.

Made-with: Cursor
2026-04-11 16:19:14 +08:00
Bingxi Zhao (Frank)
4799aaeef0 fix: improve provider switch 2026-04-11 13:00:54 +08:00
Bingxi Zhao (Frank)
5384224932 fix: leakage repair 2026-04-11 12:23:32 +08:00
Bingxi Zhao (Frank)
445e7622e9 fix: docker, chat with refs 2026-04-10 22:54:58 +08:00
Bingxi Zhao (Frank)
df844b8216 feat: add visualize capability with Chart.js/SVG rendering pipeline
- Add visualize agent pipeline (analysis → code generation → review)
- Add VisualizeCapability with request config and registry wiring
- Add frontend VisualizeConfigPanel, VisualizationViewer components
- Add chart.js and react-chartjs-2 dependencies
- Improve math_animator YON_IMAGE anchor block prompts (en/zh)
- Add minimax model override (supports_response_format: false)
- Suppress noisy uvicorn WebSocket connection logs
- Add selective HTTP access logging middleware (non-200 only)

Made-with: Cursor
2026-04-10 20:09:36 +08:00
Bingxi Zhao (Frank)
d988be7757 Merge commit 'refs/pull/266/head' of github.com:HKUDS/DeepTutor into dev
Made-with: Cursor

# Conflicts:
#	deeptutor/agents/math_animator/renderer.py
2026-04-08 20:08:19 +08:00
Bingxi Zhao (Frank)
5960fbc0f7 refactor: remove litellm dependency, align provider architecture
- Replace litellm with native openai + anthropic SDKs across both
  services and tutorbot layers
- Add 5 new providers: mistral, stepfun, xiaomi_mimo, qianfan, ovms
- Add `backend` field to ProviderSpec for SDK routing
- New TutorBot OpenAICompatProvider (openai SDK) and AnthropicProvider
  (anthropic SDK), replacing LiteLLMProvider
- Rewrite services/llm/executors.py to use openai SDK directly
- Remove litellm from factory.py routing, token_tracker, provider_cmd
- Auto-fallback to streaming for tool-call format errors (fixes #265)
- Settings UI: provider dropdown with auto base-url fill
- Clean up litellm from requirements/cli.txt and pyproject.toml

Made-with: Cursor
2026-04-08 19:59:44 +08:00
kevin
f6a081812e fix(guide): prevent polling from overwriting user's tab navigation
Backend poll (fetchPageStatuses) returns current_index=0 from
start_learning, which mergePageState unconditionally applied — causing
the UI to snap back to page 1 whenever the user clicked another tab.

Only accept server's current_index when user hasn't navigated yet
(current_index < 0), preserving tab selection during polling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 16:12:03 +08:00
kevin
055c467a40 fix(guide): fix KaTeX math rendering in Guided Learning pages
- Configure $...$ and $$...$$ delimiters in auto-render (KaTeX default
  only recognizes $$..$$ and \(\..\))
- Remove broken SRI integrity hashes from CDN links (hash mismatch blocks
  resource loading)
- Add parent-window fallback rendering: detects bare LaTeX text nodes
  (e.g. \underbrace, \mathbb without $ wrapping), auto-wraps them,
  then calls renderMathInElement — handles cases where inline init script
  gets corrupted by page content containing </script> strings
- Increase guide agent max_tokens 8192->16384 to prevent HTML truncation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 16:12:03 +08:00
kevin
5c048a9609 Fix Windows compatibility for Math Animator renderer
This PR fixes multiple Windows compatibility issues that prevented
the Math Animator from generating videos on Windows systems.

### Changes

1. **renderer.py**: Fix subprocess execution on Windows
   - Replace `asyncio.create_subprocess_exec` with `subprocess.run` + `asyncio.to_thread`
   - The original approach silently fails on Windows when uvicorn uses SelectorEventLoop (default)
   - New approach works regardless of event loop type

2. **code_generator_agent.yaml (en/zh)**: Add Manim v0.20.1 compatibility constraints
   - Prohibit `MarkupText` (requires LaTeX)
   - Prohibit `stroke_dash_pattern` parameter (not supported in v0.20.1)
   - Prohibit `save_state()` method (not supported in MovingCameraScene)
   - Applied to both `generate_system` and `retry_system` sections

3. **ChatComposer.tsx**: Suppress hydration warning for i18n placeholder
   - Add `suppressHydrationWarning` to textarea
   - Resolves SSR/CSR text mismatch warning for language-specific placeholders

### Testing

- ✅ CLI mode: Successfully generated Pythagorean theorem animation (660KB)
- ✅ Web mode: Successfully generated cone cross-section animation
- ✅ Auto-retry: First attempt error → LLM repair → second attempt success

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 16:12:03 +08:00
kevin
7b55f11c7e Fix Windows compatibility for Math Animator renderer
This PR fixes multiple Windows compatibility issues that prevented
the Math Animator from generating videos on Windows systems.

### Changes

1. **renderer.py**: Fix subprocess execution on Windows
   - Replace `asyncio.create_subprocess_exec` with `subprocess.run` + `asyncio.to_thread`
   - The original approach silently fails on Windows when uvicorn uses SelectorEventLoop (default)
   - New approach works regardless of event loop type

2. **code_generator_agent.yaml (en/zh)**: Add Manim v0.20.1 compatibility constraints
   - Prohibit `MarkupText` (requires LaTeX)
   - Prohibit `stroke_dash_pattern` parameter (not supported in v0.20.1)
   - Prohibit `save_state()` method (not supported in MovingCameraScene)
   - Applied to both `generate_system` and `retry_system` sections

3. **ChatComposer.tsx**: Suppress hydration warning for i18n placeholder
   - Add `suppressHydrationWarning` to textarea
   - Resolves SSR/CSR text mismatch warning for language-specific placeholders

### Testing

- ✅ CLI mode: Successfully generated Pythagorean theorem animation (660KB)
- ✅ Web mode: Successfully generated cone cross-section animation
- ✅ Auto-retry: First attempt error → LLM repair → second attempt success

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 22:36:03 +08:00
zzhtx258
58d72b9c22 update 2026-03-29 13:16:14 +08:00
zzhtx258
26a82e77d3 update 2026-03-29 12:45:37 +08:00
Bingxi Zhao (Frank)
9bd7d5fba7 update readme 2026-03-24 21:07:49 +08:00
zzhtx258
f04851e536 fix bugs, and enforce math video length 2026-03-22 19:49:14 +08:00
Bingxi Zhao (Frank)
c15e22a4b3 chore: stable fix, add tutorbot 2026-03-20 20:27:17 +08:00
Bingxi Zhao (Frank)
a5d601d39f fix: RAM buffer problems 2026-03-14 01:46:13 +08:00
Bingxi Zhao (Frank)
9e8cea8294 fix: update embeddings config & provide perplexity search 2026-03-14 00:37:52 +08:00
Bingxi Zhao (Frank)
f3779138ae fix: remove lightrag and unify llm & search config 2026-03-13 23:48:49 +08:00
Bingxi Zhao (Frank)
9c18bf0705 codebase cleanup and decoupled, introduce cli operation 2026-03-13 20:42:16 +08:00
Bingxi Zhao (Frank)
91197f3729 chore: deeptutor 2.0 2026-03-13 01:47:38 +08:00
Bingxi Zhao (Frank)
6ff107d960 Merge branch 'dev' into feat/vision_slover 2026-03-09 14:47:53 +08:00
Bingxi Zhao
e1bedcb336 refact solver+questiongen, add base module for personalization 2026-02-12 12:29:16 +08:00
logo
55472f05c1 实现用于图像分析和 GeoGebra 可视化的视觉求解器模块 2026-02-04 00:58:04 +08:00
logo
bb01d13d85 实现用于图像分析和 GeoGebra 可视化的视觉求解器模块
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-04 00:36:22 +08:00
logo
23ece51e4d 增加启动逻辑 2026-02-03 20:14:12 +08:00
Pancake
2384bd8e75 updage mem 2026-02-03 01:33:24 +08:00
logo
db1cfda90f Merge branch 'main' into feat/debug_run 2026-01-28 23:56:06 +08:00
logo
2cb225aab2 Merge branch 'main' into feat/debug_run 2026-01-27 11:09:44 +08:00
Frant1cc
7c0315daab feat:Add a scrollbar for confirmation 2026-01-25 22:28:46 +08:00
Frant1cc
83f7a53f50 fix:i18n improvenment 2026-01-25 22:27:31 +08:00
Frant1cc
5ecd8b76a6 fix:CoWriterEditor scroll sync 2026-01-25 19:00:30 +08:00
Pancake
0d860a2d12 fix: lint 2026-01-23 01:42:25 +08:00
Pancake
543b507395 feat: add document incrementally 2026-01-22 23:54:45 +08:00
Pancake
100ae27105 feat: add Chinese, frontend persistence, flexible import of rag library 2026-01-21 21:05:48 +08:00
Pancake
cd09c424fe fix: frontend session persistence 2026-01-19 15:48:02 +08:00
Pancake
51902b1491 fix: temperature issues & dockek npm build problem 2026-01-19 14:38:46 +08:00
Bingxi Zhao
3f40ce4301 fix: web lint 2026-01-18 17:40:10 +08:00