From 8daf6b368ce1d4cac74c4f14ae66f20b9a41fc87 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Thu, 9 Apr 2026 13:35:46 +0800 Subject: [PATCH] feat: Add pending tasks and active status to WikiStats - Introduced `pending_tasks` and `is_active` fields in the `WikiStats` interface to track the number of tasks waiting for processing and the current activity status of the wiki ingestion. - Updated localization files for English, Korean, Russian, and Chinese to include a new message for displaying the number of pending tasks in the wiki queue. - Enhanced the `WikiBrowser` component to display the queue status, improving user awareness of ongoing tasks. - Implemented polling logic to refresh wiki stats periodically when there are pending tasks or active ingestion, ensuring up-to-date information is presented. These changes enhance the functionality and user experience of the wiki management system by providing real-time insights into task status. --- frontend/src/api/wiki/index.ts | 2 + frontend/src/i18n/locales/en-US.ts | 1 + frontend/src/i18n/locales/ko-KR.ts | 1 + frontend/src/i18n/locales/ru-RU.ts | 1 + frontend/src/i18n/locales/zh-CN.ts | 1 + .../src/views/knowledge/wiki/WikiBrowser.vue | 46 +- internal/agent/prompts_wiki.go | 20 +- internal/application/repository/wiki_page.go | 3 - internal/application/service/knowledge.go | 85 ++- internal/application/service/wiki_ingest.go | 715 +++++++++++++----- internal/application/service/wiki_page.go | 26 +- .../docparser/image_resolver_test.go | 4 +- internal/router/sync_task.go | 1 - internal/router/task.go | 1 - internal/types/task.go | 1 - internal/types/wiki_page.go | 2 + migrations/versioned/000036_wiki_pages.up.sql | 1 + 17 files changed, 682 insertions(+), 229 deletions(-) diff --git a/frontend/src/api/wiki/index.ts b/frontend/src/api/wiki/index.ts index 1d32743a..485c8c7b 100644 --- a/frontend/src/api/wiki/index.ts +++ b/frontend/src/api/wiki/index.ts @@ -40,6 +40,8 @@ export interface WikiStats { total_links: number; orphan_count: number; recent_updates: WikiPage[]; + pending_tasks: number; + is_active: boolean; } // Wiki API Functions diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 7c07562d..82ca1f03 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1636,6 +1636,7 @@ export default { showArrows: 'Show arrows', hideArrows: 'Hide arrows', healthCheck: 'Health Check', + queueStatus: '{count} pending tasks in Wiki queue', }, buttons: { create: 'Create Knowledge Base', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 2d2cacbf..a0a7cc79 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -2159,6 +2159,7 @@ export default { showArrows: '화살표 표시', hideArrows: '화살표 숨기기', healthCheck: "상태 점검", + queueStatus: "Wiki 대기열에 {count}개의 보류 중인 작업", }, buttons: { create: "지식베이스 생성", diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 5d0becba..e6a910a4 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1838,6 +1838,7 @@ export default { showArrows: 'Показать стрелки', hideArrows: 'Скрыть стрелки', healthCheck: 'Проверка здоровья', + queueStatus: '{count} ожидающих задач в очереди Wiki', }, buttons: { create: 'Создать базу знаний', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index ee83338b..6f0b44bf 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -2144,6 +2144,7 @@ export default { showArrows: '显示箭头', hideArrows: '隐藏箭头', healthCheck: "健康检查", + queueStatus: "Wiki 队列中 {count} 个待处理任务", }, buttons: { create: "创建知识库", diff --git a/frontend/src/views/knowledge/wiki/WikiBrowser.vue b/frontend/src/views/knowledge/wiki/WikiBrowser.vue index 4f4223f8..9c8b0727 100644 --- a/frontend/src/views/knowledge/wiki/WikiBrowser.vue +++ b/frontend/src/views/knowledge/wiki/WikiBrowser.vue @@ -91,6 +91,10 @@