feat(frontend): visualize document parsing pipeline with span timeline

Renders a five-segment timeline (DocReader → Chunking → Embedding →
Multimodal → PostProcess) above each document so users can see exactly
which stage a document is in and which one failed, instead of a flat
"Parsing..." spinner.

- New KnowledgeProcessingTimeline component (full + compact mode):
  full mode lives at the top of doc-content for any document not yet
  in `completed`; compact mode replaces the parsing/failed lines in
  the card hover popover with a five-dot mini-progress.
- Polls GET /api/v1/knowledge/:id/spans every 2s while
  parse_status in {pending, processing}; stops on terminal status or
  unmount. Hover popover instances opt out of polling to avoid
  amplifying requests on grid hover.
- Failed / cancelled steps expand into an error card with the raw
  error_message, an error_code -> localized title + suggestion mapping
  for the twelve canonical codes (DOCREADER_TIMEOUT, EMBEDDING_RATE_LIMIT,
  ...), and a "Copy details" button that pastes the failed span JSON
  for support tickets.
- Attempt selector renders only when latest_attempt > 1 so reparse
  history is browsable; the latest attempt is selected by default.
- Last-error block under the timeline includes a Retry button that
  calls reparseKnowledge() and immediately re-fetches.
- i18n strings added under knowledgeStages for en-US, zh-CN, ko-KR,
  ru-RU. ja-JP locale file does not exist in this repository.
This commit is contained in:
wizardchen
2026-05-27 16:01:54 +08:00
committed by lyingbug
parent 06f94a4811
commit 1d8ac301c2
9 changed files with 777 additions and 6 deletions
+5
View File
@@ -223,6 +223,11 @@ export function reparseKnowledge(id: string) {
return post(`/api/v1/knowledge/${id}/reparse`);
}
export function getKnowledgeSpans(id: string, attempt?: number) {
const qs = attempt ? `?attempt=${attempt}` : '';
return get(`/api/v1/knowledge/${id}/spans${qs}`);
}
export function delKnowledgeDetails(id: string) {
return del(`/api/v1/knowledge/${id}`);
}