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(timeline): track fetch attempts and surface silent polling failures

wizardchen933386943932
diff --git a/frontend/src/components/knowledge-processing-timeline.vue b/frontend/src/components/knowledge-processing-timeline.vue
index 9c601da84..5c1e5b5ef 100644
--- a/frontend/src/components/knowledge-processing-timeline.vue
+++ b/frontend/src/components/knowledge-processing-timeline.vue
@@ -66,6 +66,13 @@ const expandedJsonKeys = ref<Set<string>>(new Set())
const nowTick = ref(Date.now())
const detailTab = ref<'overview' | 'input' | 'output' | 'metadata' | 'raw'>('overview')
const lastFetchedAt = ref<number>(0)
+// Tracks consecutive fetch failures so the "更新于" caption can surface
+// staleness. When the parse_status is mid-flight but every fetch is
+// hitting an error, the loop keeps going silently — without this
+// indicator the user sees a spinning auto-refresh icon while the
+// caption ages without explanation.
+const failedAttempts = ref<number>(0)
+const lastFetchOk = ref<boolean>(true)
const attemptStatuses = reactive<Map<number, string>>(new Map())
@@ -132,11 +139,12 @@ async function fetchSpans(opts: { manual?: boolean } = {}) {
if (!props.knowledgeId) return
if (opts.manual) refreshing.value = true
if (!data.value) loading.value = true
+ let attemptOk = false
try {
const res: any = await getKnowledgeSpans(props.knowledgeId, selectedAttempt.value)
if (res?.success && res.data) {
data.value = res.data as SpansResponse
- lastFetchedAt.value = Date.now()
+ attemptOk = true
if (selectedAttempt.value === undefined) {
selectedAttempt.value = data.value.attempt
}
@@ -151,6 +159,18 @@ async function fetchSpans(opts: { manual?: boolean } = {}) {
} catch (e) {
emit('update:hasSpans', false)
} finally {
+ // Track every attempt, not just successful ones — otherwise a
+ // failing endpoint would leave "更新于 X 秒前" frozen forever while
+ // the spinner spins. The user explicitly reported this confusing
+ // behavior. Pair with failedAttempts to render a "fetch failed"
+ // hint when consecutive errors pile up.
+ lastFetchedAt.value = Date.now()
+ lastFetchOk.value = attemptOk
+ if (attemptOk) {
+ failedAttempts.value = 0
+ } else {
+ failedAttempts.value += 1
+ }
loading.value = false
refreshing.value = false
}
@@ -951,10 +971,21 @@ const stageBreakdown = computed<StageRowSummary[]>(() => {
<!-- "Updated X ago" — always visible. While polling it
stays small (1-2s); after parsing finishes it shows
staleness when a user reopens the drawer hours later
- ("更新于 3 小时前") so they know to hit refresh. -->
+ ("更新于 3 小时前") so they know to hit refresh. When
+ consecutive fetches are failing we surface that —
+ otherwise the caption would silently age while the
+ spinner kept spinning. -->
<div v-if="lastFetchedAt" class="kp-stat kp-stat-end">
<span class="kp-stat-label">{{ t('knowledgeStages.head.updated') }}</span>
- <span class="kp-stat-val">{{ formatRelativeTime(lastFetchedAt) }}</span>
+ <span
+ class="kp-stat-val"
+ :class="{ 'kp-stat-val-stale': !lastFetchOk }"
+ >{{ formatRelativeTime(lastFetchedAt) }}</span>
+ <span
+ v-if="failedAttempts > 1"
+ class="kp-stat-fail"
+ :title="t('knowledgeStages.fetchFailed', { n: failedAttempts })"
+ >⚠ {{ t('knowledgeStages.fetchFailedShort') }}</span>
</div>
</div>
@@ -1542,6 +1573,28 @@ const stageBreakdown = computed<StageRowSummary[]>(() => {
gap: 4px;
}
+/* Stale value styling — "更新于" goes muted/strikethrough-ish when the
+ last fetch attempt failed, signaling that the timestamp may not
+ reflect fresh server state. */
+.kp-stat-val-stale {
+ color: var(--td-text-color-placeholder);
+ font-style: italic;
+}
+
+/* Inline "fetch failed" hint that lives next to "更新于". Surfaces
+ silent polling failures (network errors, success=false responses)
+ so the user knows the loop is running but not landing data. */
+.kp-stat-fail {
+ margin-left: 6px;
+ font-size: 11px;
+ color: var(--td-error-color);
+ background: var(--td-error-color-light);
+ padding: 1px 6px;
+ border-radius: var(--td-radius-default);
+ letter-spacing: 0.02em;
+ cursor: help;
+}
+
.kp-stat-num { color: var(--td-text-color-primary); }
.kp-stat-slash { color: var(--td-text-color-placeholder); margin: 0 1px; }
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index e1871aa5c..16560b18a 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -403,6 +403,8 @@ export default {
liveTooltip: 'Parsing in progress — auto-refreshes every 2s',
autoRefreshOn: 'Auto-refreshing',
autoRefreshOff: 'Auto-refresh stopped',
+ fetchFailed: 'Last {n} refreshes failed — data may be stale, click refresh to retry',
+ fetchFailedShort: 'fetch failed',
viewTrace: 'View trace',
justNow: 'just now',
secondsAgo: '{n}s ago',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index ae83eb35e..9a3148fb3 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -409,6 +409,8 @@ export default {
liveTooltip: "파싱 진행 중 — 2초마다 자동 새로고침",
autoRefreshOn: "자동 새로고침 중",
autoRefreshOff: "자동 새로고침 중지됨",
+ fetchFailed: "최근 {n}회 새로고침 실패 — 데이터가 오래되었을 수 있습니다, 새로고침 버튼을 눌러 재시도하세요",
+ fetchFailedShort: "새로고침 실패",
viewTrace: "Trace 보기",
justNow: "방금",
secondsAgo: "{n}초 전",
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 47747ccda..a8e406721 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -406,6 +406,8 @@ export default {
liveTooltip: "解析进行中,每 2 秒自动刷新一次",
autoRefreshOn: "自动刷新中",
autoRefreshOff: "已停止自动刷新",
+ fetchFailed: "最近 {n} 次刷新都失败了,数据可能已过期,点击刷新按钮重试",
+ fetchFailedShort: "刷新失败",
viewTrace: "查看 Trace",
justNow: "刚刚",
secondsAgo: "{n} 秒前",