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
+50
View File
@@ -391,6 +391,56 @@ export default {
deleteSuccess: "知识删除成功!",
chunkLoadFailed: "分块加载失败",
},
knowledgeStages: {
title: "处理流水线",
attempt: "第 {n} 次尝试",
attemptLatest: "第 {n} 次尝试(最新)",
retry: "重新解析",
copyDetails: "复制详情",
copied: "已复制到剪贴板",
noActivity: "暂无解析记录",
stage: {
docreader: "文档解析",
chunking: "分块",
embedding: "向量化",
multimodal: "多模态识别",
postprocess: "后处理",
},
status: {
pending: "等待中",
running: "进行中",
done: "已完成",
failed: "失败",
skipped: "已跳过",
cancelled: "已取消",
},
errorCode: {
DOCREADER_TIMEOUT: "文档解析超时",
DOCREADER_TIMEOUT_SUGGESTION: "文件可能过大或解析服务繁忙,请稍后重试或拆分文档。",
DOCREADER_UNAVAILABLE: "文档解析服务不可用",
DOCREADER_UNAVAILABLE_SUGGESTION: "解析服务离线,请联系管理员。",
DOCREADER_PARSE_FAILED: "文档解析失败",
DOCREADER_PARSE_FAILED_SUGGESTION: "无法解析该文件,请确认文件未损坏。",
CHUNKING_FAILED: "分块失败",
CHUNKING_FAILED_SUGGESTION: "请尝试调整知识库的分块配置。",
EMBEDDING_RATE_LIMIT: "向量服务被限流",
EMBEDDING_RATE_LIMIT_SUGGESTION: "向量服务触发限流,请稍后重试。",
EMBEDDING_PROVIDER_FAIL: "向量服务错误",
EMBEDDING_PROVIDER_FAIL_SUGGESTION: "向量服务返回错误,请检查供应商配置。",
VECTORSTORE_WRITE_FAILED: "向量库写入失败",
VECTORSTORE_WRITE_FAILED_SUGGESTION: "向量库拒绝写入,请检查向量库可用性。",
MULTIMODAL_VLM_FAILED: "图像理解失败",
MULTIMODAL_VLM_FAILED_SUGGESTION: "部分图像无法处理,文档可能仍可使用。",
MULTIMODAL_ALL_FAILED: "全部图像多模态处理失败",
MULTIMODAL_ALL_FAILED_SUGGESTION: "请检查多模态模型配置。",
TASK_TIMEOUT: "任务超过最大运行时间",
TASK_TIMEOUT_SUGGESTION: "任务运行时间超出限制,请重试或联系支持人员。",
UPSTREAM_FAILED: "上游阶段失败已中止",
UPSTREAM_FAILED_SUGGESTION: "前置阶段失败,导致本步骤无法执行。",
UNKNOWN: "未知错误",
UNKNOWN_SUGGESTION: "请查看应用日志获取详细信息。",
},
},
chat: {
title: "对话",
newChat: "新对话",