4771 Commits

Author SHA1 Message Date
Bingxi Zhao
6168a8bc29 Merge pull request #474 from wedone/fix/mu-data
fix: 系统性修复多用户数据隔离问题
2026-05-12 16:47:18 +08:00
Bingxi Zhao (Frank)
8bae3caedb fix(multi-user): resolve rebase regressions and decouple auth from middleware
After rebasing onto current dev (v1.3.10), several issues surfaced that the
original PR did not account for:

Frontend (rebase regressions from older PR base):
- web/lib/knowledge-api.ts: restore 6 KnowledgeBaseSummary fields
  (id, source, assigned, read_only, provenance_label, available) that the
  multi-user knowledge feature added between the PR base and current dev.
- web/app/(workspace)/agents/page.tsx: restore the array-vs-{bots}
  response shape fallback; the tutorbot list endpoint returns either form.
- web/components/sidebar/BookRecent.tsx: wrap path with apiUrl() — the
  apiFetch swap accidentally dropped the wrapper.
- web/components/space/MemorySection.tsx: restore try/catch error toasts
  in loadMemory and clearMemory (still present in saveMemory and
  refreshMemory; were dropped in load/clear).

Backend (decouple auth from middleware):
- Remove user_context_middleware from api/main.py. It was redundant with
  require_auth (sets the user ContextVar for every protected route) and
  ws_require_auth (sets it for every WebSocket). When AUTH_ENABLED=true and
  a request had no valid token, the middleware fell back to
  local_admin_user() — harmless because require_auth then raised 401, but
  a latent footgun if any code reads the ContextVar before the dependency
  resolves. Removing it makes the auth flow single-pathed and removes the
  "ctx set twice" pattern.
- auth.py: add explicit type annotations to ws_require_auth (returns
  Token | _WsAuthFailed) and the ws_auth_failed sentinel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:43:58 +08:00
mtsui-cmyk
4431e2d4b0 fix: allow quiz answer textarea vertical resize 2026-05-12 15:33:09 +08:00
iwedo
4de4f5e9c9 fix: 系统性修复多用户数据隔离问题
核心问题:
1. HTTP请求的用户上下文仅依赖require_auth依赖,中间件层无保障
2. WebSocket端点(tutorbot/vision_solver/question/knowledge/book)缺少手动认证
3. CoWriterStorage在__init__中固定path_service,单例后路径不再变化
4. get_path_service()静默降级到默认实例,无日志

修复内容:
- 添加user_context_middleware中间件,确保每个HTTP请求都正确设置用户ContextVar
- 添加ws_require_auth()统一WebSocket认证函数,所有WS端点使用
- 修复tutorbot/vision_solver/question/knowledge/book的WebSocket认证
- 统一chat/solve/unified_ws的WebSocket认证为ws_require_auth()
- CoWriterStorage改为@property延迟获取path_service + 按workspace缓存
- get_path_service()降级时输出warning日志
2026-05-12 15:32:57 +08:00
iwedo
a581549e12 fix(multi-user): 修复旧版会话管理器的路径捕获问题,实现完整的数据隔离
核心修改:
- BaseSessionManager: path_service/sessions_file 改为 @property 延迟解析
- chat.py/solve.py: 移除模块级单例,WebSocket 端点添加手动认证
- BookStorage/BookEngine: path_service 延迟解析 + get_book_storage/engine 按路径缓存
- TutorBotManager: path_service 延迟解析 + 修复硬编码 data/tutorbot 路径
- MemoryService: _path_service 改为 @property 延迟解析

修复原理:延迟解析确保路径在请求时(用户上下文已设置)才解析;
按路径缓存确保不同用户获得不同实例,同一用户复用实例。

TutorBot 现在按用户隔离到 multi-user/<uid>/tutorbot/ 而非共享的 data/tutorbot/
2026-05-12 15:32:23 +08:00
WeDone
20c42491a2 fix: replace all fetch() with apiFetch() for authenticated API calls
- Replace fetch() with apiFetch() in 18 files across web/
- Remove redundant credentials: 'include' since apiFetch handles it
- Affected modules: auth, admin, session, skills, book, knowledge,
  notebook, co-writer, playground, agents, sidebar components,
  SaveToNotebookModal, VersionBadge, useTextSource
- Fixes 401 Unauthorized errors in multi-user mode
2026-05-12 15:32:23 +08:00
Bingxi Zhao
06f80c393f Merge pull request #465 from truffle-dev/fix/disable-ssl-verify-sweep
fix(ssl): extend DISABLE_SSL_VERIFY coverage to codex provider and four embedding adapters
2026-05-12 15:28:20 +08:00
Bingxi Zhao
b9dc14c698 Merge pull request #441 from wedone/fix/quiz-question-paragraph-spacing
fix(agents): normalize single newlines to markdown paragraphs in quiz content
2026-05-12 15:28:15 +08:00
unknown
fc4d4f7ca2 fix(H4): add complete_review_task to clean finished tasks from queue 2026-05-12 14:56:59 +08:00
unknown
232f41a446 fix(C1): wrap handler call in try/finally to always save progress 2026-05-12 14:54:22 +08:00
unknown
7af85c5781 fix(H2): deduplicate error records, use RetryAttempt, graduate on correct answer 2026-05-12 14:52:43 +08:00
unknown
325af91a02 fix(C5): use .get() instead of .pop() to avoid mutating request body 2026-05-12 14:51:05 +08:00
unknown
7fb2c11ed1 fix(C2): add _safe_json_parse helper to handle malformed LLM responses 2026-05-12 14:50:02 +08:00
unknown
08e1829fde fix(C4): remove router singleton race condition + use unique tmp filenames in atomic write 2026-05-12 14:45:59 +08:00
unknown
a308e398f2 baseline: snapshot before guided-learning bugfixes 2026-05-12 14:37:28 +08:00
Bingxi Zhao (Frank)
3d5c3a1eb5 improve chat 2026-05-12 02:20:30 +08:00
Bingxi Zhao (Frank)
85779c846b refactor env settings and installation 2026-05-11 12:59:56 +08:00
truffle
93d24f776a fix(ssl): extend DISABLE_SSL_VERIFY coverage to codex provider and four embedding adapters
v1.3.10 added the `openai_http_client.disable_ssl_verify_enabled` helper
and applied it to the SDK paths (`openai_sdk` embedding,
`openai_compat_provider`, `azure_openai_provider`, tutorbot
`openai_compat_provider`). Five raw-httpx call sites still ignored the
flag:

- `provider_core/openai_codex_provider.py:79` hardcoded `verify=True` on
  the first attempt before falling back on `CERTIFICATE_VERIFY_FAILED`.
- `embedding/adapters/openai_compatible.py:193` constructed
  `httpx.AsyncClient(timeout=...)` with no `verify` kwarg.
- `embedding/adapters/jina.py:89`, `ollama.py:61`, `cohere.py:115` same.

Each site now consults the helper and passes `verify=not
disable_ssl_verify_enabled()`. The codex provider's
`CERTIFICATE_VERIFY_FAILED` retry path is preserved unchanged.

Tests:

- `tests/services/embedding/test_disable_ssl_verify.py` (5 adapter tests
  + 1 production-guard test) asserts each adapter passes `verify=False`
  when the flag is set and `verify=True` otherwise.
- `tests/services/llm/test_codex_disable_ssl_verify.py` covers the
  default-true case, flag-flip-to-false case, and the
  retry-on-cert-failure fallback.
2026-05-10 23:08:40 +00:00
Bingxi Zhao (Frank)
ac8f00bd65 prepare v1.3.10 release v1.3.10 2026-05-10 22:56:21 +08:00
Bingxi Zhao (Frank)
df925e6f97 fix lint 2026-05-09 03:11:27 +08:00
Bingxi Zhao (Frank)
72bcdd77d8 prepare v1.3.9 release v1.3.9 2026-05-09 02:53:14 +08:00
Bingxi Zhao
57cd6fe753 Merge pull request #455 from Bortlesboat/codex/tutorbot-nvidia-nim
fix: add TutorBot NVIDIA NIM provider support
2026-05-09 01:57:26 +08:00
Bingxi Zhao
4f7f069ae9 Merge pull request #457 from philliplagoc/feature/sidebar-tooltips
feat: tooltips for sidebar
2026-05-09 01:55:18 +08:00
Bingxi Zhao
accfab92da Merge pull request #452 from wedone/feat/add-zulip-channel
feat(tutorbot): add Zulip channel support
2026-05-09 01:55:03 +08:00
Bingxi Zhao
4733a1afc9 Merge pull request #449 from kagura-agent/fix/user-message-newline-444
fix(web): preserve newlines in user chat messages
2026-05-09 01:54:51 +08:00
Bingxi Zhao
657f68652c Merge pull request #445 from Starfie1d1272/feat/cli-start-command
feat: add deeptutor start command to launch backend and frontend together
2026-05-09 01:54:38 +08:00
Bingxi Zhao
7b73769fe9 Merge pull request #453 from Starfie1d1272/fix/deepseek-reasoning-effort-minimal
fix(llm): stop sending reasoning_effort=minimal as top-level param to providers that reject it
2026-05-09 01:54:23 +08:00
Bingxi Zhao
f1572e8f29 Merge pull request #447 from Starfie1d1272/fix/add-deepseek-v4-pricing
fix: add deepseek-v4-flash and deepseek-v4-pro to model pricing table
2026-05-09 01:54:10 +08:00
Bingxi Zhao
d6b8eedcca Merge pull request #442 from wedone/fix/context-window-vision-upstream
fix: raise context_window ceiling and add qwen vision support
2026-05-09 01:53:52 +08:00
Phillip Lagoc
bba92a865e chore: files edited after running pre-commit for all files 2026-05-07 16:19:21 -07:00
Phillip Lagoc
73c1798e75 docs: replaced placeholder tooltip text 2026-05-07 16:07:09 -07:00
Phillip Lagoc
45267e275d removed tooltips from expanded state 2026-05-07 15:50:55 -07:00
Phillip Lagoc
3d44bb62c1 show expanded sidebar tooltips on the right instead of bottom 2026-05-07 15:09:16 -07:00
Phillip Lagoc
5732b1501f scope CSS selectors, add pointer-events-none, instant focus, unmount cleanup, made prettier 2026-05-07 14:34:28 -07:00
Phillip Lagoc
19679b7bae added truncation and max sizing to tooltips 2026-05-07 14:24:36 -07:00
Phillip Lagoc
646a241b02 wrapped PRIMARY_NAV items with Tooltip for expanded and collapsed states, refactored Tooltip prop 2026-05-07 14:05:24 -07:00
Bortlesboat
b4cca8e108 fix: add tutorbot nvidia nim provider 2026-05-07 16:23:22 -04:00
Bingxi Zhao (Frank)
2c4769a96f prepare v1.3.8 release
Co-authored-by: Cursor <cursoragent@cursor.com>
v1.3.8
2026-05-08 02:36:24 +08:00
whf
8e5c601012 Fix #3: add init-modules endpoint + router registration in main.py (with Codex edge case fix) 2026-05-07 22:05:21 +08:00
whf
44a77b4afd Fix #3+#5: add init-modules endpoint + DEBUG_MODE (LEARNING_DEBUG=1 for second-level intervals) 2026-05-07 21:54:04 +08:00
Phillip Lagoc
2f3af52890 feat(sidebar): add i18n-aware tooltips, init new Tooltip component, and refactoring PRIMARY_NAV_BAR in SidebarShell 2026-05-06 14:55:36 -07:00
unknown
4f30e0fa1a fix(guided-learning): convert error_type string to ErrorType enum in submit_answer 2026-05-06 22:48:46 +08:00
Xinyu Du
1ef3995f62 fix(llm): stop sending reasoning_effort=minimal as top-level param to providers that reject it
DeepSeek only accepts high / max / low / medium / xhigh for reasoning_effort,
but the code unconditionally forwarded the configured value as a top-level
parameter.  When LLM_REASONING_EFFORT=minimal (DeepTutor convention for
"disable thinking"), DeepSeek rejects the request with:

  unknown variant minimal, expected one of high, low, medium, max, xhigh

Fix across three provider layers:
- provider_core:  skip top-level reasoning_effort when the provider spec
  has thinking_style and the semantic effort is "minimal" — the thinking
  control is already expressed via extra_body
- tutorbot:  same logic + add deepseek & minimax to the extra_body chain
  (they were missing, so thinking disable was silently ignored)
- cloud_provider:  skip reasoning_effort=minimal for providers that handle
  thinking through extra_body

Other providers (OpenAI, Anthropic, Gemini, Mistral, etc.) are unaffected
because they either don't have thinking_style or accept minimal natively.
2026-05-06 21:28:27 +08:00
WeDone
dccc7fc08b feat(tutorbot): add Zulip channel support
Add Zulip as a new messaging channel for DeepTutor tutorbot.

Features:
- Private message and stream message support
- Event queue API (register/get_events/deregister) for reliable message listening
- Three-layer infinite loop protection (max_message_id, own message filter, dedup)
- File upload/download with configurable timeout and retry
- Permission control via allow_from (supports both user_id and email)
- Stream group policy: mention (respond only when mentioned) / open (respond to all)
- KaTeX/LaTeX bidirectional conversion for math formulas
- Typing indicator support for private chats (Zulip native API)

Technical highlights:
- Uses call_endpoint with custom timeout instead of send_message/upload_file
  (default 15s timeout causes ReadTimeout on file uploads)
- Sync-async bridging via run_in_executor and run_coroutine_threadsafe
- Automatic event queue re-registration on BAD_EVENT_QUEUE_ID error

Tests: 88 unit tests covering all core functionality
2026-05-06 20:34:27 +08:00
kagura-agent
3ebf26225e fix(web): preserve newlines in user chat messages (#444)
Add whitespace-pre-wrap to the user message content div so that
newlines entered via Shift+Enter are rendered correctly instead of
being collapsed into a single line.
2026-05-06 15:35:54 +08:00
whf
e9b03cb523 i18n: Add Guided Learning translations (zh/en) and wiring in ChatMessages + playground 2026-05-06 10:45:55 +08:00
whf
5ebdf19893 Frontend: Add Guided Learning to capability picker in chat page 2026-05-06 09:56:43 +08:00
whf
23bf4537e7 Block 12: Add guided learning API router (GET progress, POST answer, GET reviews) 2026-05-06 09:49:32 +08:00
whf
66c0a7f9ca Block 7-11: Add GuidedLearningCapability — full Framework v1.8.2 state machine with mock LLM 2026-05-06 09:42:13 +08:00
whf
225c645137 Block 6+13: Add 6 new BlockType values + register GuidedLearningCapability 2026-05-06 02:31:43 +08:00