WeKnora/frontend/src/api
wizardchen d0144f3586 perf(wiki): move ingest log to event table and index to on-demand API
Fixes O(n²) write amplification during wiki ingest on large KBs. Previously
every ingest/retract op re-wrote the single `slug='log'` row end-to-end and
every batch re-wrote the entire `slug='index'` directory markdown. On a 40k-
doc KB the log row grew to tens of MB and the index row to several MB, so
each batch triggered giant TOAST updates that dominated ingest wall time.

Log: new `wiki_log_entries` event table (`id DESC` indexed per KB) replaces
the single TEXT row. Batch ingest now collects entries and flushes them
once per batch via `AppendBatch`. Each entry stores `pages_affected` as
JSONB `[{slug,title}]` so the UI can render real titles; custom Scan falls
back to legacy `[]string` so older rows still deserialize.

Index: `wiki_pages[slug=index].content` keeps only the LLM-generated intro
(a few KB). The directory is now served by a structured paginated API
(`GetIndexView`) that reads `slug/title/summary` per type with cursor
pagination, so the agent and the frontend only pull the slice they need.
`RebuildIndexPage` degrades to a no-op; agent `wiki_read_page('index')`
synthesizes a small top-K overview and points callers at `wiki_search`.

Ingest resilience: LLM calls wrap with 3-attempt exponential backoff on
transient errors (5xx/408/429, transport resets/timeouts). Summary/extract
failures now bubble up so the batch's failed-op requeue path runs instead
of silently dropping the doc.

Frontend: sidebar Index/Log entries switch to dedicated views. Index view
streams intro → Summary → Entity → Concept → Synthesis → Comparison via
IntersectionObserver (with a nextTick re-check so small KBs still load
every section). Log view uses cursor pagination; pages_affected renders
titles with slug tooltip.

- new migration: migrations/versioned/000040_wiki_log_entries.{up,down}.sql
- tests: log repo pagination + legacy Scan, ListByTypeLight windowing,
  renderIndexOverviewForAgent output, isTransientLLMError classifier

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 21:48:52 +08:00
..
agent feat(im): tenant-wide IM channels overview under the user menu 2026-04-30 15:29:14 +08:00
auth fix oidc auth login 2026-05-05 00:21:41 +08:00
chat fix(sessions): review fixes for keyword search / pinning / IM titles 2026-04-30 16:23:00 +08:00
chunker feat(frontend): chunking debug panel with live preview 2026-05-06 17:17:07 +08:00
datasource feat(frontend): tree view resource selector with cascading selection 2026-04-08 16:31:25 +08:00
initialization fix(chunker): QA audit — pointer DTOs, profile reuse, stats correctness 2026-05-06 17:17:07 +08:00
knowledge-base feat(knowledge-base): add document batch delete and list view 2026-04-29 12:01:38 +08:00
model feat(models): support custom HTTP headers across all remote model calls 2026-04-23 23:36:40 +08:00
organization feat(api): integrate per-organization resource counts into organization listing 2026-02-09 11:40:25 +08:00
skill feat: enhance agent skills sandbox configuration and availability 2026-02-04 20:58:24 +08:00
system feat(ks3): add KS3 object storage support 2026-05-05 00:22:27 +08:00
tenant feat(tenant): expose API Key reset from the API Info page 2026-04-29 20:07:38 +08:00
wiki perf(wiki): move ingest log to event table and index to on-demand API 2026-05-08 21:48:52 +08:00
chat-history.ts feat: implement chat history and retrieval settings 2026-03-09 11:46:56 +08:00
mcp-service.ts feat: add built-in MCP service support 2026-03-05 21:57:01 +08:00
retrieval.ts feat: implement chat history and retrieval settings 2026-03-09 11:46:56 +08:00
vector-store.ts feat: add VectorStore management UI settings page 2026-04-17 21:51:25 +08:00
web-search-provider.ts feat: search engine adds proxy addresses and adds SSRF verification. 2026-04-17 16:38:02 +08:00
web-search.ts feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00