Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix: count skipped stages in parsing progress

ttommybotd3055ae06886
diff --git a/frontend/src/components/knowledge-processing-timeline.test.ts b/frontend/src/components/knowledge-processing-timeline.test.ts
new file mode 100644
index 000000000..7e1abf855
--- /dev/null
+++ b/frontend/src/components/knowledge-processing-timeline.test.ts
@@ -0,0 +1,28 @@
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import { dirname, join } from 'node:path'
+import test from 'node:test'
+import { fileURLToPath } from 'node:url'
+
+const here = dirname(fileURLToPath(import.meta.url))
+const source = readFileSync(join(here, 'knowledge-processing-timeline.vue'), 'utf8')
+
+test('counts skipped stages when determining the current stage', () => {
+ const currentStageIndex = source.slice(
+ source.indexOf('const currentStageIndex'),
+ source.indexOf('function formatDuration'),
+ )
+
+ assert.match(currentStageIndex, /status === 'done' \|\| s\.status === 'skipped'/)
+ assert.match(currentStageIndex, /Math\.min\(traversed \+ 1, stages\.value\.length\)/)
+})
+
+test('counts skipped stages in the completed stage total', () => {
+ const stagesStatDisplay = source.slice(
+ source.indexOf('const stagesStatDisplay'),
+ source.indexOf('const postprocessTaskStats'),
+ )
+
+ assert.match(stagesStatDisplay, /status === 'done' \|\| s\.status === 'skipped'/)
+ assert.match(stagesStatDisplay, /value: `\$\{completedCount\}\/\$\{total\}`/)
+})
diff --git a/frontend/src/components/knowledge-processing-timeline.vue b/frontend/src/components/knowledge-processing-timeline.vue
index d406501df..2cf82b64f 100644
--- a/frontend/src/components/knowledge-processing-timeline.vue
+++ b/frontend/src/components/knowledge-processing-timeline.vue
@@ -167,8 +167,10 @@ const currentStageLabel = computed(() => {
const currentStageIndex = computed(() => {
const idx = stages.value.findIndex((s) => s.status === 'running' || s.status === 'failed')
if (idx >= 0) return idx + 1
- const done = stages.value.filter((s) => s.status === 'done').length
- return Math.min(done + 1, stages.value.length)
+ const traversed = stages.value.filter(
+ (s) => s.status === 'done' || s.status === 'skipped',
+ ).length
+ return Math.min(traversed + 1, stages.value.length)
})
function formatDuration(ms?: number): string {
@@ -1182,7 +1184,9 @@ const showLastError = computed(() =>
const stagesStatDisplay = computed(() => {
const total = stages.value.length
- const doneCount = stages.value.filter((s) => s.status === 'done').length
+ const completedCount = stages.value.filter(
+ (s) => s.status === 'done' || s.status === 'skipped',
+ ).length
const inProgress = stages.value.some(
(s) => s.status === 'running' || s.status === 'failed' || s.status === 'pending',
)
@@ -1194,7 +1198,7 @@ const stagesStatDisplay = computed(() => {
}
return {
label: t('knowledgeStages.head.stagesDone'),
- value: `${doneCount}/${total}`,
+ value: `${completedCount}/${total}`,
}
})