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
+13 -4
View File
@@ -2,6 +2,7 @@
import { ref, onMounted, onUnmounted, watch, reactive, computed, nextTick, h, type ComponentPublicInstance } from "vue";
import { MessagePlugin, Icon as TIcon } from "tdesign-vue-next";
import DocContent from "@/components/doc-content.vue";
import KnowledgeProcessingTimeline from "@/components/knowledge-processing-timeline.vue";
import useKnowledgeBase from '@/hooks/useKnowledgeBase';
import { useRoute, useRouter } from 'vue-router';
import EmptyKnowledge from '@/components/empty-knowledge.vue';
@@ -2440,12 +2441,20 @@ async function createNewSession(value: string): Promise<void> {
<div
v-if="hoveredCardItem.parse_status === 'processing' || hoveredCardItem.parse_status === 'pending'"
class="card-popover-status parsing">
<t-icon name="loading" size="14px" /> {{ t('knowledgeBase.parsingInProgress') }}
<KnowledgeProcessingTimeline
:knowledge-id="hoveredCardItem.id"
:parse-status="hoveredCardItem.parse_status"
:auto-poll="false"
:compact="true"
/>
</div>
<div v-else-if="hoveredCardItem.parse_status === 'failed'" class="card-popover-status failure">
<t-icon name="close-circle" size="14px" /> {{ t('knowledgeBase.parsingFailed') }}
<span v-if="(hoveredCardItem as any).error_message" class="card-popover-error-msg">{{
(hoveredCardItem as any).error_message }}</span>
<KnowledgeProcessingTimeline
:knowledge-id="hoveredCardItem.id"
:parse-status="hoveredCardItem.parse_status"
:auto-poll="false"
:compact="true"
/>
</div>
<div v-else-if="hoveredCardItem.parse_status === 'draft'" class="card-popover-status draft">
{{ t('knowledgeBase.draft') }}