Commit Graph

514 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
cf3bd89133 Merge branch 'main' of github.com:HKUDS/DeepTutor
Made-with: Cursor

# Conflicts:
#	README.md
2026-04-13 03:19:27 +08:00
Bingxi Zhao (Frank)
3ef46b9179 Merge branch 'dev' into main for v1.0.3 2026-04-13 03:18:41 +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
Bingxi Zhao
a3a209534e Merge pull request #292 from cskwork/feat/wrong-answer-note
feat: add wrong-answer note for cross-session quiz review
2026-04-12 21:54:19 +08:00
Bingxi Zhao
68f85f3708 Merge pull request #299 from SuperMarioYL/feat/embedding-model-mismatch-detection
feat: detect embedding model mismatch in knowledge bases
2026-04-12 21:36:46 +08:00
supermario_leo
8255f8bba2 feat: detect embedding model mismatch in knowledge bases
Record the embedding model and dimension used to index each knowledge base
in kb_config.json. On subsequent loads, compare the stored fingerprint
against the currently configured embedding model and flag mismatched KBs
with needs_reindex=True and embedding_mismatch=True.

When a mismatched KB is searched, a warning is included in the search
result so callers know search quality may be degraded and re-indexing
is recommended.

This prevents silent search quality degradation when users switch
embedding models (e.g., from text-embedding-3-large to nomic-embed-text)
without re-indexing their existing knowledge bases.
2026-04-12 18:26:12 +08:00
chaohuang-ai
d1a03ec3c7 Update README.md 2026-04-12 18:21:24 +08:00
Bingxi Zhao
43a4c8bed5 Merge pull request #295 from OlegSob-glitch/fix/history-reference-empty-context
fix: merge system messages and add history reference fallback
2026-04-12 15:34:57 +08:00
chaohuang-ai
128579acdb Update README.md 2026-04-12 10:07:01 +08:00
OlegSob-glitch
6e9ef28db2 fix: merge system messages and add history reference fallback
This PR fixes two related issues:

1. Qwen vLLM 'System message must be at the beginning' error:
   - deeptutor/agents/chat/agentic_pipeline.py: Merge system_prompt and memory_context into single system message, filter out system messages from conversation_history
   - deeptutor/services/session/context_builder.py: Filter out system messages from DB since summary is already added as system
   - deeptutor/agents/chat/chat_agent.py: Merge system prompt and RAG context into single system message

2. History reference (@reference) empty context issue:
   - deeptutor/services/session/turn_runtime.py: Add fallback to raw record content when NotebookAnalysisAgent.analyze() returns empty string

Benefits:
- Fixes Qwen vLLM compatibility issue completely
- Enables history reference feature to work correctly
- Reduces token usage by eliminating duplicate system messages
- Does not break any functionality - system context from DB is already in compressed_summary
- Cleaner message structure with exactly one system message at position 0

Testing:
- Verified with Qwen model via vLLM - no more template errors
- Chat with memory files (PROFILE.md/SUMMARY.md) works correctly
- Chat with conversation history works correctly
- History reference (@reference) now works correctly
- Conversation continuation works without errors
- No regression with other models (GPT-4, etc.)

Closes #294
2026-04-12 02:26:44 +03: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)
285bee5bb7 Merge branch 'dev' v1.0.2 2026-04-11 16:19:33 +08: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
24df900a0a v1.0.2
v1.0.2
2026-04-11 13:07:58 +08:00
Bingxi Zhao (Frank)
9676d88472 docs: add v1.0.2 release notes and update README
Made-with: Cursor
2026-04-11 13:07:27 +08:00
Bingxi Zhao (Frank)
4799aaeef0 fix: improve provider switch 2026-04-11 13:00:54 +08:00
Bingxi Zhao (Frank)
4010a33aa3 fix: simplify search consolidation and use explicit runtime config in test runner
- Remove CONSOLIDATION_TYPES and explicit consolidation parameter;
  auto-consolidate for providers without native answer support.
- Build LLM/Embedding/Search configs directly from resolved runtime
  config in ConfigTestRunner instead of relying on global cache.
- Clean up default settings by removing unused consolidation fields.

Made-with: Cursor
2026-04-11 12:54:38 +08:00
Bingxi Zhao
d94119bf18 Merge pull request #286 from OlegSob-glitch/fix/searxng-template-fallback
fix: add auto-fallback for search providers without templates
2026-04-11 12:36:39 +08:00
Bingxi Zhao (Frank)
5384224932 fix: leakage repair 2026-04-11 12:23:32 +08:00
OlegSob-glitch
9f99dc2992 fix: add auto-fallback for search providers without templates
- Modified _get_template_for_provider() to return None instead of raising ValueError
- Added _format_simple_results() as provider-agnostic fallback formatter
- Modified _consolidate_with_template() to use fallback when no template exists
- Fixes searxng (and other providers) failing with 'no template consolidation available' error
2026-04-11 04:04:09 +03:00
Bingxi Zhao (Frank)
445e7622e9 fix: docker, chat with refs v1.0.1 2026-04-10 22:54:58 +08:00
Bingxi Zhao (Frank)
5a016ad29c release: add v1.0.1 release notes and update README
Add release notes for v1.0.1 covering Visualize capability, quiz
duplicate prevention, o4-mini model support, and server logging
improvements. Update README releases section accordingly.

Made-with: Cursor
2026-04-10 20:57:36 +08:00
Bingxi Zhao (Frank)
525cdf563e Merge branch 'dev'
Made-with: Cursor

# Conflicts:
#	deeptutor/agents/question/agents/generator.py
#	deeptutor/agents/question/coordinator.py
#	deeptutor/agents/question/prompts/en/generator.yaml
#	deeptutor/agents/question/prompts/zh/generator.yaml
2026-04-10 20:50:37 +08:00
Bingxi Zhao (Frank)
a0ce450d80 refactor: separate previous_questions from history_context in quiz generation
Fixes semantic overloading introduced by PR #281 — history_context (conversation
history) is no longer mixed with the generated-questions dedup list.

- Add dedicated `previous_questions` parameter through Generator pipeline
- Extract `_strip_template_knowledge_context()` reused by both generate and repair paths
- Add `_format_previous_questions()` with MAX_PREVIOUS_QUESTIONS=20 cap
- Move language labels into YAML templates (en/zh) to avoid language mixing
- Simplify coordinator to pass raw list instead of string concatenation

Made-with: Cursor
2026-04-10 20:48:47 +08:00
Bingxi Zhao (Frank)
c8ccec4b4f Revert "Merge pull request #281 from Leadernelson/main"
This reverts commit 36c24d73c6, reversing
changes made to fc7b0fed59.
2026-04-10 20:47:14 +08:00
Bingxi Zhao (Frank)
43ea51b08a Merge remote-tracking branch 'origin/main' into dev 2026-04-10 20:43:58 +08:00
Bingxi Zhao
36c24d73c6 Merge pull request #281 from Leadernelson/main
Prevent duplicate quiz questions by removing duplicates and adding history
2026-04-10 20:43:45 +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
9a3e718e66 Merge pull request #275 from kuishou68/fix/issue-274-o4-mini-max-completion-tokens
fix: extend o-series regex to cover o4-mini and future o-series models
2026-04-10 20:03:44 +08:00
Lucas Menten
0ca42b8862 Merge pull request #1 from Leadernelson/copilot/bugfix-same-quiz-questions
fix: prevent duplicate quiz questions caused by duplicated knowledge_context and missing generation history
2026-04-10 11:06:39 +02:00
copilot-swe-agent[bot]
b05abd269c fix: prevent duplicate quiz questions by removing duplicated knowledge_context and adding generation history
Agent-Logs-Url: https://github.com/Leadernelson/DeepTutor/sessions/98d69209-ee73-4cd7-832f-eac0650b097e

Co-authored-by: Leadernelson <184500545+Leadernelson@users.noreply.github.com>
2026-04-10 09:02:35 +00:00
Cocoon-Break
512fc9e665 fix: extend o-series regex to cover o4-mini and future o-series models (Closes #274) 2026-04-10 09:02:30 +08:00
Bingxi Zhao (Frank)
fc7b0fed59 docs: add v1.0.0-beta.4 release notes and README entry
Made-with: Cursor
v1.0.0-beta.4
2026-04-10 00:55:17 +08:00
Bingxi Zhao
780c248192 Merge pull request #272 from kuishou68/fix/issue-271-mime-type-case-insensitive
fix: use lowercased filename in mimetypes.guess_type() for consistent MIME validation
2026-04-10 00:48:41 +08:00
Bingxi Zhao (Frank)
0950c98e18 fix: merge PR #268 (embedding progress + 429 retry) with review fixes
Merge oxkage's embedding progress tracking and HTTP 429 rate limit
retry (PR #268), with the following review-driven improvements:

- Restore default batch_size=10 and request_timeout=60 to avoid
  performance regression for non-free-tier users
- Promote batch_delay to EmbeddingConfig (was private adapter attr)
  so all adapters respect user configuration instead of hardcoded 0.5s
- Use set_progress_callback() on existing embed model instead of
  creating a new CustomEmbedding instance (avoids global state mutation)
- Clean up progress callback in finally blocks to prevent leaking
  into subsequent search/query calls
- Wire progress_callback through add_documents (not just initialize)
- Remove dead HTTPStatusError 429 branch (already handled before
  raise_for_status)
- Remove unused total_docs variable in initializer

Made-with: Cursor
2026-04-10 00:33:57 +08:00
Cocoon-Break
cd33a527c1 fix: use lowercased filename in mimetypes.guess_type for consistent MIME validation 2026-04-10 00:30:06 +08:00
Bingxi Zhao (Frank)
3bc12fe28d fix: library management when start tour 2026-04-10 00:29:17 +08:00
Bingxi Zhao (Frank)
11efec2d48 Merge branch 'dev' — i18n scope clarification v1.0.0-beta.3 2026-04-08 20:22:26 +08:00
Bingxi Zhao (Frank)
b002975200 docs: clarify i18n coverage scope in README release note
Made-with: Cursor
2026-04-08 20:22:11 +08:00
Bingxi Zhao (Frank)
ecb329eb30 Merge branch 'dev' for v1.0.0-beta.3 release 2026-04-08 20:21:04 +08:00
Bingxi Zhao (Frank)
76f4d7e5e4 docs: add v1.0.0-beta.3 release notes and update README
Made-with: Cursor
2026-04-08 20:20:43 +08:00
Bingxi Zhao (Frank)
c86395a485 docs: update readme 2026-04-08 20:16:34 +08:00
Bingxi Zhao
4892a889a2 Merge pull request #262 from LocNguyenSGU/fix/issue-261-copilot-login-docs
docs: clarify github copilot provider login semantics
2026-04-08 20:13:50 +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)
40c1a38995 fix: Windows-compatible Manim subprocess with streaming output
Replace asyncio.create_subprocess_exec with subprocess.Popen + reader
threads + asyncio.Queue. This fixes Windows SelectorEventLoop
incompatibility while preserving real-time line-by-line progress output
(unlike subprocess.run which buffers until completion).

Made-with: Cursor
2026-04-08 20:07:05 +08:00
Bingxi Zhao (Frank)
60b9b36357 docs: update readme 2026-04-08 20:02:13 +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
Bingxi Zhao (Frank)
546ca2f532 Merge remote-tracking branch 'origin/main' into dev 2026-04-08 17:30:58 +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