Commit Graph

356 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
453b06063b Merge PR #1344 Ukrainian locale after conflict resolution 2026-09-23 10:38:18 +08:00
Bingxi Zhao (Frank)
d6825cb695 Merge PR #1344: add Ukrainian language support 2026-09-23 10:34:40 +08:00
Bingxi Zhao (Frank)
7d330f043c Merge remote-tracking branch 'origin/pr-1503' into codex/merge-pr-1503
# Conflicts:
#	deeptutor/services/session/turns/executor.py
2026-09-23 10:32:28 +08:00
Bingxi Zhao
921160d3f8 Merge pull request #1335 from TaoufikMejri/feat/add-french-translation
feat: add french as supported language
2026-09-23 10:26:44 +08:00
Bingxi Zhao
c4cf5a69a5 Merge pull request #1532 from antmikinka/feat/tts-math-speak
feat(voice): verbalize LaTeX in TTS with a Math speak setting
2026-09-23 10:26:23 +08:00
Bingxi Zhao
44e7da44db Merge pull request #1494 from wumajiehechuan-lab/feat/lightrag-llm-timeout
feat(rag): expose LightRAG llm_timeout so extraction LLM timeouts are tunable
2026-09-23 10:25:50 +08:00
Bingxi Zhao
1c3ce00d0b Merge pull request #1323 from larryluozhang/fix/learner-surface-map
fix(learner): complete surface map for first-party learner screens + flip preset on restrictions assignment (#1222)
2026-09-23 10:25:29 +08:00
Bingxi Zhao
b05ccdba58 Merge pull request #1408 from AoHanBei/feat/1405-chatgpt-import
feat(imports): add ChatGPT conversation export support
2026-09-23 10:23:40 +08:00
Bingxi Zhao (Frank)
eabc17d79f release: v1.6.10
Native LightRAG role models: extraction, keyword, query and vision each
resolve their own model, vision indexing pins a vision-capable model
instead of silently degrading, and a knowledge base records which models
and which embedding built it. A published index refuses queries after its
embedding identity changes rather than searching a foreign vector space,
and a rebuild is confirmed against the configuration it will actually
use — a stale confirmation is rejected instead of quietly rebuilding
something else. A failed publication is withdrawn, not left half-written.

PDF attachments follow the parsing engine configured for the workspace,
report the stage they are in, and a truncated answer says it was
truncated with the counters that prove it. Providers are no longer
filtered out of the embedding picker on an unverifiable capability guess:
configure the model and test it. Visualize's temperature and token budget
are settings rather than literals. Notebook evidence no longer depends on
the chat session that produced it.

See assets/releases/ver1-6-10.md for the full notes, and the README
translations for the propagated prose.
2026-09-22 21:36:27 +08:00
larryluozhang
0c2666c010 fix(learner): complete surface map for first-party learner screens + flip preset on restrictions assignment (#1222)
Rebased onto current main (v1.6.9 layout): _learning_surface_for_path now
lives in deeptutor/api/routers/auth.py; change content unchanged.

- map /api/mastery-paths/* to chat (learner's own per-user progress data)
- map GET/HEAD/OPTIONS /api/knowledge-bases* to reading (browse-only;
  mutations still default-deny)
- pass request.method into the surface lookup
- put_guardian_restrictions: when the account has no learning_policy yet,
  seed the default learner grant and flip the preset to learner, avoiding
  the standard-preset+policy mix that renders the admin shell and 403-storms
- regression tests: tests/multi_user/test_learning_surface_map.py (22 tests)
2026-09-22 00:57:28 +08:00
Bingxi Zhao (Frank)
1fe74df0ed fix(notebook): decouple evidence from chat sessions (#1519) 2026-09-21 14:50:02 +08:00
Bingxi Zhao (Frank)
3800028fa8 merge: integrate LightRAG roles with embedding compatibility 2026-09-21 13:36:18 +08:00
Bingxi Zhao
9ea95ef0dd Merge pull request #1281 from NoxsMedia/codex/nox-35-standalone-embedding
fix: enforce native LightRAG embedding compatibility
2026-09-21 13:15:09 +08:00
NoxsMedia
ac8cc4a97d fix: preserve selected embeddings in confirmed LightRAG rebuilds 2026-09-21 02:57:39 +00:00
NoxsMedia
73e062c594 fix: preserve LightRAG compatibility with per-KB embedding bindings 2026-09-21 02:45:23 +00:00
Bingxi Zhao (Frank)
01da2757bd fix(learning): complete adaptive linked evidence flow 2026-09-21 10:35:22 +08:00
Anthony
044c0e7598 feat(voice): verbalize LaTeX in TTS with a Math speak setting
Always strip dollar-sign math delimiters so the voice model never says dollar. When Math speak is on (default), also convert fractions, powers, Greek, and common operators into spoken words. Settings > Voice exposes the toggle; the server applies it on every /tts call.
2026-09-20 11:57:05 -07:00
Bingxi Zhao (Frank)
da856ad670 release: v1.6.9
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.

Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
2026-09-21 02:30:40 +08:00
Bingxi Zhao (Frank)
367195b7cf Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	deeptutor/api/routers/reading_extensions.py
#	tests/reading/test_extension_router.py
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-09-19 16:41:12 +08:00
Bingxi Zhao (Frank)
fe482d64eb fix(assessment): persist reading answers reliably across learning surfaces 2026-09-19 16:16:39 +08:00
Bingxi Zhao (Frank)
20d2596f44 Merge branch 'codex/question-pr-1475' into codex/question-pr-1504 2026-09-19 16:13:22 +08:00
Bingxi Zhao (Frank)
a37605b3a0 Merge branch 'codex/question-pr-1341' into codex/question-pr-1504
# Conflicts:
#	deeptutor/services/session/sqlite_store.py
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-09-19 16:13:22 +08:00
Bingxi Zhao (Frank)
6c72de5185 fix(question-bank): validate source filters against accepted sources 2026-09-19 16:12:43 +08:00
Bingxi Zhao (Frank)
715e5de592 Merge remote-tracking branch 'origin/dev' into codex/question-pr-1341 2026-09-19 16:11:05 +08:00
Gao-Chenkai
3eb831d108 feat(learning): persist cross-surface Focus-Check in Question Bank
Route Mastery, Book, and Immersive Reading attempts through one review record so reading quizzes are server-graded, retryable, and show the learner's pick next to the reference answer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 21:21:15 +08:00
flower-moon
8c718530b2 feat(reading): caption embedded figures at ingest
A figure only reaches the model while its page is the open one: the viewport
injection carries at most four images, and read_material returns text. That
leaves a question spanning several pages of a deck (or several decks)
answered without ever seeing the figures it is about.

Ingest can now describe each stored figure once, with the active vision model,
and write the description back into media.json next to the image it belongs
to. captions.py mirrors the RAG image-description pipeline: it is gated on
supports_multimodal_images(), runs at image_description_limits() concurrency
with a per-image timeout, tolerates individual failures, and returns the
number of rows it wrote. The work is best-effort by design: the upload path
schedules it as a background task that can only log, never fail an ingest.

Off by default (document_parsing.json -> image_caption, surfaced through the
document-parsing settings API), so nothing changes until the switch is on.

store.refresh_document() lands alongside it: re-extraction of an already
ingested document that keeps annotations/positions/bookmarks/assets in place,
rewrites units/media/manifest in one atomic swap, refuses to touch anything
when the raw bytes are gone or the unit count would change, and carries
existing captions over by image name so a refresh never silently discards
descriptions the API already paid for.
2026-09-17 18:46:28 +08:00
flower-moon
e1b4954a23 feat(documents): Office/PDF 嵌入图片全链路支持 — 提取、显示、喂视觉模型
- 新增 utils/document_images.py:docx(OOXML单遍扫描)/pptx(python-pptx+OOXML兜底)/pdf(pymupdf, xref去重)
  嵌入图片提取,统一 [图片 N: name] 正文标记 + ImageBudget 预算(单文档12张/12MB,单回合16张/12MB)
- 聊天附件:extract_documents_from_records 产出嵌入图片 image 记录(embedded 标记),
  turn_runtime 托管附件库后经现有多模态注入管道发给视觉模型,UI 零改动渲染图片附件
- 阅读区:Extraction.media + 标记→locator 映射,入库 media/ + media.json,
  新增 GET /materials/{id}/media(/{name}) API,TextUnitView 图片条(article 外侧,不动逐字锚定),
  immersive_reading 回合注入当前页图片(≤4张),read_material 结果附图片清单
- docx 富提取顺带补齐 python-docx 一直丢掉的表格文本;EMF/WMF 矢量图计数尾注不静默丢弃
- MaterialManifest 新增 media_count(向后兼容);media_path 索引校验防路径穿越
- tests: test_document_images.py 8 用例;utils 51 + 阅读区全套 + session 209 通过

详细文档: docs/文档图片支持_提取显示与视觉模型_2026-09-07.md (gitignored)
2026-09-17 18:46:28 +08:00
wumajiehechuan-lab
cf61846076 feat(rag): expose LightRAG llm_timeout so extraction LLM timeouts are tunable
- add llm_timeout (default 240, clamp 60-3600) to lightrag runtime settings
- pass it through constructor_kwargs_from_settings() as default_llm_timeout
- accept llm_timeout in the LightRAG pipeline config API
- update generated openapi/api.ts contracts
- extend settings + wiring tests
2026-09-16 18:34:57 -07:00
Gao-Chenkai
a448e8743c fix: keep adaptive SRS UI compatible with base tests 2026-09-15 21:31:20 +08:00
Gao-Chenkai
21cd2bb23f feat: complete adaptive SRS persistence and review UI 2026-09-15 21:00:01 +08:00
Bingxi Zhao (Frank)
c547a5a31c fix: resolve verified learning, ingestion and delivery regressions
Bind mastery drafts before their opening turn and preserve stored session modes.
Track chat duration from submission through terminal completion. Run async reading
extensions on their event loop and allow retries after cancellable timeouts.
Allow first uploads into empty LlamaIndex knowledge bases, preserve Telegram
thread routing, parse embedding Retry-After dates, and enforce robots rules and
host pacing during documentation crawls, including redirects.

Fixes #1461
Fixes #1458
Fixes #1451
Fixes #1448
Fixes #1392
Fixes #1429
Refs #1435, #1412

Reuses contributions from PRs #1462, #1452 and #1403.

Co-authored-by: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: AoHanBei <dongaohan21@gmail.com>
Co-authored-by: Gao-Chenkai <DevChenkai@outlook.com>
2026-09-15 20:06:57 +08:00
NoxsMedia
82d4d7d7a3 chore: sync PR #1281 with current dev 2026-09-14 11:51:32 +00:00
NoxsMedia
0dd6912ff1 chore: sync PR #1265 with current dev 2026-09-14 11:51:22 +00:00
Bingxi Zhao (Frank)
6f618f1abf refactor(settings): one place decides whether a catalog write reset the clients
#1436 put the right question in `_invalidate_runtime_caches` — did this apply
actually change the catalog — but left every caller to answer it. Five
endpoints assembled their own `catalog_before`/`catalog_after` pair in four
different ways: two full extra `load()` calls at the codex endpoint, `current`
before secret restoration at one, `service.load()` after apply at two others.
And the kwargs are optional, so the sixth endpoint that forgets them gets the
unconditional reset #1421 was about, silently.

Whether the catalog changed is a property of the file, not of the caller.
`_runtime_catalog_write()` brackets the write and reads both sides itself, so
a caller states only what it always knew: this writes the catalog. A write
that raises leaves the block without resetting, which is what a failed write
should do — there is nothing new for the clients to read.

Behaviour is unchanged; the two skip paths #1436 tested still pass untouched.
Adds the two it did not: finishing the tour with nothing edited, which is the
cold start the report described, and applying one service that already holds
the value it is being given.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 01:59:59 +08:00
evan188199-tech
9b066b5f98 feat(sessions): add recycle bin for deleted chats (#1398)
* feat(sessions): add recycle bin for deleted chats

Implements soft-delete for chat sessions so users can restore
accidentally deleted conversations from a recycle bin.

Backend:
- Schema migration adds deleted_at REAL column to sessions
- delete_session becomes a soft-delete (sets deleted_at timestamp)
- New store methods: restore_session, purge_session, list_deleted_sessions
- Session list queries exclude soft-deleted sessions
- API endpoints: GET /sessions/recycle-bin, POST /{id}/restore,
  DELETE /{id}/purge (purge triggers attachment/mastery cleanup)

Frontend:
- RecycleBinSection: collapsible sidebar section listing deleted
  sessions with Restore and Delete permanently actions
- Wired into SidebarShell via recycleBinSlot prop
- API client functions for list, restore, and purge
- en/zh translations for all recycle-bin UI strings

Tests: 6 backend tests covering the soft-delete lifecycle

* style: apply ruff format to sqlite_store

* fix(sessions): preserve recycled chat artifacts

* feat(sessions): fold #1444's backend into this recycle bin

#1444 built the same feature from the other end. This PR had the SQLite
column, the routes and the sidebar UI; #1444 had the protocol declarations,
the PocketBase implementation and the CLI wording. Neither shipped alone —
this one left multi-user deployments answering AttributeError on
/recycle-bin, and #1444 built a bin nobody could see. Closes #1444; its
backend is here.

Kept from here: one `deleted_at` column. #1444 carried `is_deleted` beside it
in both backends, and `deleted_at IS NOT NULL` already says everything the
boolean did — PocketBase now derives the outward `is_deleted` field from the
timestamp instead of storing it twice.

Taken from #1444: the naming, which turns out to fix the residual both PRs
shipped with. `delete_session` keeps meaning what every existing caller
already meant by it — remove the row — so `reading.py`'s two internal
cleanups need no patch: a deleted reading workspace still takes its sessions
with it instead of depositing them in a learner's bin, where restoring one
would resurrect a session pointing at a workspace that no longer exists. The
chat surface's delete is a separate, explicitly named `soft_delete_session`,
and `hard_delete_session` empties the bin. Both backends agree, and the
protocol declares all five so a backend cannot silently lack one again.

`test_entries_cascade_on_session_purge` becomes two tests, because there are
now two deletions worth pinning: one the bin can undo, and one that skips it
and cascades immediately.

Co-Authored-By: sjagadee <srini.jagadeesh@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 01:43:35 +08:00
Srini Jagadeesh
3006ec3671 feat: Persistent File Library with API router (issue #1437) (#1446)
* feat: Persistent File Library with API router (issue #1437)

FileLibraryStore (deeptutor/services/storage/file_library.py):
- add_file: stores bytes to disk, deduplicates by SHA-256
- get_file: returns entry by id
- delete_file: soft-delete, idempotent
- hard_delete_file: permanent delete (requires prior soft-delete)
- restore_file: clears is_deleted, idempotent
- list_files: active entries, newest-first, paginated
- search_files: case-insensitive filename LIKE search
- resolve_path: returns absolute Path or None

API router (deeptutor/api/routers/file_library.py):
- GET    /files/library/              — list files
- POST   /files/library/              — multipart upload with SHA-256 deduplication
- GET    /files/library/search        — filename search
- GET    /files/library/{id}          — get entry
- GET    /files/library/{id}/download — download file bytes
- DELETE /files/library/{id}          — soft-delete
- POST   /files/library/{id}/restore   — restore soft-deleted

25 unit tests + 20 API integration tests, all passing.

* fix: ruff import-sort/unused-import fixes for file library

* fix: scope file library singleton per user, close upload dedup race

- get_file_library_store() was caching the FileLibraryStore under a
  hardcoded key ("default") instead of the resolved per-user root, so
  in multi-user deployments every user after the first shared one
  library (list/get/download/delete/restore all leaked across
  accounts). Now resolves get_path_service().get_user_root() on every
  call and keys the cache by str(user_root), mirroring
  get_attachment_store().

- _add_file_sync's SHA-256 dedup check was a plain SELECT followed by
  an INSERT with no synchronization; concurrent uploads of identical
  content (double-click, duplicate tabs, client retries) could both
  miss the dedup lookup and each create a duplicate row/file. Added a
  per-instance lock around the check-then-write-then-insert sequence,
  plus a partial unique index on sha256 (active rows only) with
  IntegrityError handling as a defense-in-depth backstop for
  multi-process deployments.

- Fixed the test fixture in test_file_library_router.py: it patched
  file_library._fl.get_file_library_store then reverted the patch
  before any request ran, so the mock never actually intercepted
  anything; removed the dead code and added tokens/auth_enabled
  support for multi-user testing.

- Added regression tests: test_upload_and_list_are_isolated_between_users
  and test_add_file_concurrent_uploads_of_same_content_do_not_duplicate,
  both verified to fail against the pre-fix code.

- ruff format on the three touched files (pre-existing line-length
  debt in code this change touches).
2026-09-14 01:28:50 +08:00
AoHanBei
00e2100adf feat(chat): search full conversation history (#1415) 2026-09-14 01:28:46 +08:00
ZQR1101
4f48ea7943 fix(settings): skip the client reset when an apply changes nothing (#1421) (#1436)
Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-09-14 01:28:27 +08:00
evan188199-tech
4c2428db09 fix(api): preserve actual proxy peer identity (#1426) (#1427)
Co-authored-by: XZH <cto@xzh.ai>
2026-09-14 01:28:09 +08:00
AoHanBei
d0f4875e2c feat(imports): add ChatGPT conversation export support 2026-09-11 16:46:46 +08:00
NoxsMedia
83c68d2bb9 chore: sync LightRAG role configuration with dev 2026-09-10 23:36:42 +00:00
evan188199-tech
0f8759f730 feat(watching): browse connected Invidious accounts (#1241) 2026-09-11 04:39:34 +08:00
Ruslan
4c6498b72a feat(i18n): add Ukrainian as a full interface and output language
Adds `uk` alongside `en` and `zh`: a complete `web/locales/uk/app.json`
(4009 keys), a Ukrainian CLI label set (102 keys), a Ukrainian quiz-judge
prompt, and the language directive that tells the model to answer in it.

Most of the diff is not the translation — it is the six independent
places that each decided, on their own, which languages exist. Every one
of them collapsed an unknown code to English *silently*, so picking
Ukrainian in Settings produced an English UI, English AI feedback and an
English chat reply, with nothing logged anywhere:

  * `services/settings/interface_settings._normalize_language` — the
    canonical normalizer; `interface.json` stored `uk`, the API returned
    `en`, and it looked like the setting had failed to save.
  * `agents/loop/prompt_blocks` — conflated two different things in one
    attribute: which prompt ASSETS exist (yaml ships `en`/`zh` only) and
    which language to ANSWER in (any). Split into `language` and
    `output_language`; the directive now takes the latter.
  * `api/routers/quiz_judge` — the supported set is now derived from
    `_JUDGE_SYSTEM_PROMPTS`, so a language cannot be advertised without a
    prompt or shipped without being advertised.
  * `web/i18n/init` — `normalizeLanguage`/`ensureLanguage`, plus a new
    exported `APP_LANGUAGES` that every picker maps over. The Settings
    toggle inlined `["en", "zh"]`, so a new locale was invisible there
    even once it existed.
  * `web/context/app-shell-storage` — held a second, private copy of the
    `AppLanguage` union; re-exported from `i18n/init` instead.
  * `runtime/banner` and `services/config/settings_spec` — the CLI wizard
    labels and the Settings language list.

Tool hints stay a per-language map from the API where only `en` is
guaranteed, so `ToolsSettingsSection` falls back instead of indexing a
missing key. Backend prompt yaml is still `en`/`zh`; Ukrainian uses the
English scaffolding with a Ukrainian output directive, which is what the
directive is for.

`tests/i18n/test_ukrainian_locale.py` pins each seam — locale key parity,
placeholder integrity, judge/prompt/normalizer coverage, and that the
Settings toggle maps over `APP_LANGUAGES` rather than a literal — so the
next language fails in CI rather than quietly in the UI.
2026-09-09 22:16:00 +03:00
ZQR1101
ed6b5da1b9 feat(partners): record wrong questions into the question bank (#1244) 2026-09-10 01:48:52 +08:00
TaoufikMejri
32848a6b57 feat: add french as supported language 2026-09-09 15:00:50 +01:00
Bingxi Zhao (Frank)
01615d6c97 fix(codex): let a Docker sign-in finish from the pasted callback address
The provider redirects the browser to a loopback listener. Under Docker
that listener runs inside the container and the standard compose file
publishes only the Web and API ports, so the browser lands on a page it
cannot load while the sign-in waits until it expires. The card treated
localhost as native local execution and offered nothing else: the remote
guidance was gated behind a non-loopback hostname, so the one deployment
that most needs a way back in was the one that never saw it (#1252).

The browser can read that address even when this process cannot receive
it, so pasting it back is the recovery path. It goes to a new
authenticated endpoint on the Web origin, which resolves the caller's
*own* pending operation rather than scanning every login in the process
— the loopback route has to identify itself by OAuth state because it
arrives without a session, and this one does not.

``parse_oauth_callback_url`` is where the address is judged, once: it
must be this login's registered redirect URI down to scheme, host, port
and path, and a repeated OAuth parameter is ambiguous rather than
untidy, so it is refused instead of resolved to one of the two. The
string is parsed and dropped — never fetched, never stored, never
echoed. Past the parse it is ``receive_callback``, so the state check,
PKCE, the registered redirect URI and owner binding are the existing
ones rather than a second implementation of them.

The form now appears whenever a login is waiting, local or remote; the
SSH command stays remote-only, because that advice is.
2026-09-08 09:53:42 +08:00
NoxsMedia
2d7904e916 chore: sync PR #1281 with current dev 2026-09-07 23:33:46 +00:00
NoxsMedia
7266c7aacf chore: sync PR #1265 with current dev 2026-09-07 23:33:46 +00:00
Bingxi Zhao (Frank)
4afc7eccb6 fix(partners): let a partner's presented file download for the person who asked
A partner web chat runs as a synthetic user, so ``workspace_present``
writes its manifest under ``data/partners/<id>/workspace``. The download
route resolved the item against the caller's own bindings only,
``binding_by_id`` refused a workspace no human account has registered,
and the attachment the transcript was still offering 404'd on click
(#1267).

``/files/outputs`` already reaches into the caller's visible partner
workspaces for the same reason (#1012); this is the other artifact URL
shape and it had been left behind. Reading the two routers side by side
was what showed the asymmetry.

The two differ in one respect, and deliberately: an output is addressed
by a relative path that several partners could each hold, so that
endpoint serves only a unique match. A workspace id is derived from the
owning user id together with the physical root and re-derived before a
stored row is trusted, so a hit inside a partner scope is that
partner's by construction and the first one is the answer.

The reported issue named three further causes — an unmounted router and
two rejected path shapes. None of them hold: both routers are mounted,
and the partner output fallback has been there since #1012.
2026-09-08 02:46:12 +08:00
Bingxi Zhao (Frank)
e7d04fccfc fix(knowledge): validate KB names on the manager, and let a bad one be deleted
A knowledge-base name is three things at once: a kb_config.json key, a
directory under data/knowledge_bases, and a path segment in every per-KB API
route. `validate_knowledge_base_name` exists to keep those three uses
compatible — its docstring says so — but it was called from one of the eight
HTTP entry points that can write a name into the config. The seven connect-*
endpoints (Obsidian, MarginNote, folder, LightRAG server, WeKnora, IMA, and
the subagent connection) did `(name or "").strip()` and wrote the result.

A name holding a "/" registers fine that way and is then unreachable.
uvicorn percent-decodes the path before routing, so %2F is a real separator
by the time Starlette matches `{kb_name}` — compiled to `[^/]+`, which cannot
span it. All 29 per-KB routes 404, delete included, while the list endpoint
takes no path parameter and keeps rendering the KB. Connected KBs are also
exempt from the orphan prune, so nothing collects it either: visible, unusable,
and removable only by hand-editing kb_config.json.

Two changes, both needed. Validation moves onto the eight `register_*`
methods, which is the seam every route already goes through — no route file
changes, since they all map ValueError to 400 — and the now-unreachable
"name is required" guards go with it. And a path-free
`POST /knowledge-bases/delete` gives the entries that predate the guard a way
out; a body is never split into segments. Widening the path route to
`{kb_name:path}` would not work: it is declared ahead of the DELETE routes
for linked folders, GitHub sources and web sources, and a greedy converter
would silently swallow all three.

Two smaller fixes ride along. The delete handler's catch-all swallowed its
own HTTPException and answered 500 with "404: ... not found" in the detail;
it now re-raises. And CreateKbModal states the rule under the field instead
of letting an untranslated English 400 be the first the user hears of it.

test_marginnote4_kb's store-collision case used "My Lib" / "My/Lib"; the
slash is now refused before that guard is reached, so it uses "My.Lib" —
still a name the rule allows, still sanitized to the same My_Lib.db.
2026-09-08 00:31:59 +08:00