diff --git a/frontend/src/components/doc-content.vue b/frontend/src/components/doc-content.vue index c7e533ab..9870b309 100644 --- a/frontend/src/components/doc-content.vue +++ b/frontend/src/components/doc-content.vue @@ -64,6 +64,35 @@ mermaid.initialize({ const props = defineProps(["visible", "details", "knowledgeType", "sourceInfo", "canEditKB", "parse_status"]); const emit = defineEmits(["closeDoc", "getDoc", "questionDeleted"]); +const hasTimelineSpans = ref(false); +const timelineDrawerVisible = ref(false); +const timelineSummary = ref<{ totalMs: number; status: string; stageIndex: number; stageTotal: number; stageLabel: string }>({ + totalMs: 0, status: '', stageIndex: 0, stageTotal: 0, stageLabel: '', +}); + +watch(() => props.details?.id, () => { + hasTimelineSpans.value = false; + timelineDrawerVisible.value = false; + timelineSummary.value = { totalMs: 0, status: '', stageIndex: 0, stageTotal: 0, stageLabel: '' }; +}); + +function formatTimelineDuration(ms: number): string { + if (!ms || ms < 0) return '—'; + if (ms < 1000) return `${Math.round(ms)}ms`; + if (ms < 60000) return `${(ms / 1000).toFixed(2)}s`; + const mins = Math.floor(ms / 60000); + const rem = ((ms % 60000) / 1000).toFixed(1); + return `${mins}m${rem}s`; +} + +function openTimeline() { + timelineDrawerVisible.value = true; +} + +function closeTimeline() { + timelineDrawerVisible.value = false; +} + marked.use({ breaks: true, // 启用单行换行转
gfm: true, // 启用 GitHub Flavored Markdown @@ -778,7 +807,7 @@ const handleDetailsScroll = () => {