fix(knowledge): refresh inflight items and skip empty chunked groups

Poll the knowledge item list every 5s while any item is still pending
or processing so the UI reflects ingestion progress without manual
refresh, and exclude items that have no active chunks from group
counters so groups with no usable content do not appear populated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 12:08:03 +08:00
parent 7443bb3260
commit 0a7b216513
2 changed files with 22 additions and 4 deletions
@@ -62,6 +62,14 @@ const groupsQuery = useQuery({
const itemsQuery = useQuery({
queryKey: computed(() => ['knowledge', 'items', selectedGroupId.value]),
queryFn: () => knowledgeApi.listItems(selectedGroupId.value ?? undefined),
refetchInterval: (query) => {
const items = query.state.data as KnowledgeItem[] | undefined
if (!items || items.length === 0) return false
const hasInflight = items.some(
(item) => item.status !== 'completed' && item.status !== 'failed',
)
return hasInflight ? 5000 : false
},
})
const columns: TableColumnsType<KnowledgeItem> = [