Embedding endpoint URLs are now transparent end-to-end: Settings shows the
exact URL DeepTutor will POST to, legacy `/v1`-style bases are migrated to
full `/embeddings` / `/api/embed` URLs, the embedding client rejects
known-provider misconfigurations early, and OpenRouter routes through the
same exact-URL HTTP adapter as other providers.
LlamaIndex RAG now refreshes embedding state before initialize/search/add,
validates persisted vectors before retrieval, and reports invalid indexes
with `needs_reindex: true` instead of raw NumPy/`NoneType` errors.
Memory refresh strips `<think>` / `<thinking>` blocks from reasoning-model
output before writing PROFILE.md / SUMMARY.md, and existing memory files
self-repair on read.
Also fixes a Deep Solve runtime regression where `MainSolver` still passed
a stale `attachments` keyword to `SolverAgent.process()`.
Adds release notes (assets/releases/ver1-3-2.md) and updates README.
Made-with: Cursor
Stability release after v1.3.0 covering safer RAG/KB routing, stronger
embedding validation, more reliable Docker/TutorBot restarts, Web UX
fixes, and Windows/encoding hardening. See assets/releases/ver1-3-1.md
for the full notes.
Made-with: Cursor
Rebased onto dev (post-#348) and resolved two UI conflicts (`web/app/(workspace)/chat/[[...sessionId]]/page.tsx` drops the now-dead `replaySnapshot` helper; `web/components/chat/home/ChatMessages.tsx` switches the last-assistant action button from the old `RotateCcw`/Retry to `RefreshCcw`/Regenerate). Smoke tests green (199 passed) and all required checks pass.
Merging: adds a `regenerate` capability wired through CLI (`/regenerate` · `/retry`), WebSocket (`type: "regenerate"`), and Web UI (per-message Regenerate button). Backend rolls back the trailing assistant via `SQLiteSessionStore.delete_message`, reuses `start_turn` through `_persist_user_message=False` / `_regenerate=True`, skips `memory_service.refresh_from_turn` on regeneration, and surfaces non-fatal `regenerate_busy` / `nothing_to_regenerate` errors. Also includes empty-response diagnostics in `_stage_responding`. 18 new tests.
* 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
Closes#227. Auth is disabled by default (AUTH_ENABLED=false) so
localhost usage is unaffected. Set AUTH_ENABLED=true +
NEXT_PUBLIC_AUTH_ENABLED=true to require login when hosting publicly.
Backend
- New deeptutor/services/auth.py: bcrypt password hashing, JWT
create/decode, multi-user JSON store with role + created_at schema,
auto-migration of old flat-hash format, first-user → admin bootstrap
- New deeptutor/api/routers/auth.py: require_auth / require_admin
FastAPI dependencies; public endpoints /login /logout /status
/register /is_first_user; admin-only /users /users/{u}/role
- deeptutor/api/main.py: Depends(require_auth) applied to all 14
protected routers
- deeptutor/api/routers/unified_ws.py: cookie-based JWT check before
ws.accept() when AUTH_ENABLED
- Added bcrypt>=4.0.0 and python-jose[cryptography]>=3.3.0 to
requirements/server.txt and pyproject.toml extras
Frontend
- web/middleware.ts: route protection; /login and /register are public
- web/lib/api.ts: apiFetch wrapper — credentials:include + 401→login
- web/lib/auth.ts: login/logout/fetchAuthStatus + register() +
checkIsFirstUser()
- web/lib/admin-api.ts: listUsers / deleteUser / setUserRole
- web/lib/session-api.ts: credentials:include on all fetches;
expectJson redirects to /login on 401 instead of throwing
- web/app/(auth)/login/page.tsx: auto-redirects to /register when no
users exist; shows success banner after registration
- web/app/(auth)/register/page.tsx: new registration page with
first-user admin notice and password confirmation
- web/app/(admin)/admin/users/page.tsx: admin dashboard — user table
with role toggle and delete; guards against self-demotion/deletion
- AdminLink and LogoutButton hidden when AUTH_ENABLED=false
- .env.example and README.md updated with auth vars and setup guide
Made-with: Cursor
- 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
The selective_access_log middleware uses logging.getLogger('uvicorn.access'),
which inherits uvicorn's AccessFormatter. That formatter unpacks record.args
into five values (client_addr, method, full_path, http_version, status_code),
but the middleware only passed four — omitting http_version — causing a
ValueError ('not enough values to unpack') on every non-200 response.
Add the missing http_version argument from the ASGI scope, defaulting to
'1.1' when absent.
Fixes#334
Signed-off-by: kagura-agent <kagura.chen28@gmail.com>
The create_and_start_bot endpoint was building a fresh BotConfig with
empty defaults (channels: {}) on every call, which caused _save_bot_config
to overwrite the on-disk config.yaml and wipe user-configured channels
(e.g. Telegram) on every server restart.
Fix: load the existing config from disk first and only fall back to
request payload defaults when no existing values are present.
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
- 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
Instead of replacing asyncio.create_subprocess_exec with subprocess.run
(which loses real-time streaming and cancellation), fix the root cause:
set WindowsProactorEventLoopPolicy before uvicorn starts so that
create_subprocess_exec works correctly on Windows.
This preserves the original async streaming renderer while fixing
Windows compatibility at the event loop level.
Made-with: Cursor