From c8cb4fab39c6d304af20099d44089e29a62d9ed4 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 16 Jun 2026 16:35:37 +0800 Subject: [PATCH] feat(wiki): show category hierarchy and navigation in wiki browser Render the wiki page category hierarchy in the browser, wire up the new category-path/availability API calls, and add the corresponding i18n strings across en-US, ko-KR, ru-RU and zh-CN locales. --- frontend/src/api/wiki/index.ts | 34 + frontend/src/i18n/locales/en-US.ts | 4 +- frontend/src/i18n/locales/ko-KR.ts | 4 +- frontend/src/i18n/locales/ru-RU.ts | 4 +- frontend/src/i18n/locales/zh-CN.ts | 4 +- .../src/views/knowledge/wiki/WikiBrowser.vue | 859 ++++++++++++++---- 6 files changed, 727 insertions(+), 182 deletions(-) diff --git a/frontend/src/api/wiki/index.ts b/frontend/src/api/wiki/index.ts index 954f5085..d52627ab 100644 --- a/frontend/src/api/wiki/index.ts +++ b/frontend/src/api/wiki/index.ts @@ -20,6 +20,11 @@ export interface WikiPage { content: string; summary: string; aliases: string[]; + parent_slug?: string; + category_path?: string[]; + wiki_path?: string; + depth?: number; + sort_order?: number; source_refs: string[]; in_links: string[]; out_links: string[]; @@ -37,6 +42,14 @@ export interface WikiPageListResponse { total_pages: number; } +export interface WikiCategoryPathListResponse { + paths: { path: string[]; count: number }[]; + total: number; + page: number; + page_size: number; + total_pages: number; +} + export interface WikiGraphMeta { mode: 'overview' | 'ego' | string; total: number; @@ -82,6 +95,8 @@ export function listWikiPages(kbId: string, params?: { page_type?: string; status?: string; query?: string; + category_path?: string; + category_depth?: number; page?: number; page_size?: number; sort_by?: string; @@ -99,6 +114,20 @@ export function listWikiPages(kbId: string, params?: { return get(`/api/v1/knowledgebase/${kbId}/wiki/pages${qs ? '?' + qs : ''}`); } +export function listWikiCategories(kbId: string, params: { + page_type: string; + parent_path?: string; + page?: number; + page_size?: number; +}) { + const query = new URLSearchParams(); + query.set('page_type', params.page_type); + if (params.parent_path) query.set('parent_path', params.parent_path); + if (params.page !== undefined) query.set('page', String(params.page)); + if (params.page_size !== undefined) query.set('page_size', String(params.page_size)); + return get(`/api/v1/knowledgebase/${kbId}/wiki/categories?${query.toString()}`); +} + export function createWikiPage(kbId: string, data: Partial) { return post(`/api/v1/knowledgebase/${kbId}/wiki/pages`, data); } @@ -119,6 +148,11 @@ export interface WikiIndexEntryDTO { slug: string; title: string; summary: string; + parent_slug?: string; + category_path?: string[]; + wiki_path?: string; + depth?: number; + sort_order?: number; } export interface WikiIndexGroup { diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 7af5e153..b4d1ce2c 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -2520,7 +2520,9 @@ export default { searchNoResults: 'No matching pages found', loadMore: 'Load more ({remaining} remaining)', filterAll: 'All Types', + loadMoreFolders: 'Load more folders', filterSummary: 'Summaries', + filterKnowledge: 'Knowledge', filterEntity: 'Entities', filterConcept: 'Concepts', filterSynthesis: 'Synthesis', @@ -4786,8 +4788,6 @@ export default { fileTypeText: 'Plain Text', fileTypeJson: 'JSON Files', fileTypeImage: 'Images', - fileTypeEbook: 'E-books', - fileTypeWebArchive: 'Web Archives', fileTypeAudiovisual: 'Audio', engines: { builtin: { diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 1d708856..15cd55c3 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -3379,7 +3379,9 @@ export default { searchNoResults: "일치하는 페이지가 없습니다", loadMore: "더 불러오기 ({remaining}개 남음)", filterAll: "전체 유형", + loadMoreFolders: "더 많은 디렉터리 불러오기", filterSummary: "요약", + filterKnowledge: "지식", filterEntity: "엔티티", filterConcept: "개념", filterSynthesis: "종합", @@ -4817,8 +4819,6 @@ export default { fileTypeText: '일반 텍스트', fileTypeJson: 'JSON 파일', fileTypeImage: '이미지', - fileTypeEbook: '전자책', - fileTypeWebArchive: '웹 아카이브', fileTypeAudiovisual: '오디오', engines: { builtin: { diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 61d6247f..300ae3d6 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -2884,7 +2884,9 @@ export default { searchNoResults: 'Страницы не найдены', loadMore: 'Загрузить ещё (осталось {remaining})', filterAll: 'Все типы', + loadMoreFolders: 'Загрузить ещё каталоги', filterSummary: 'Резюме', + filterKnowledge: 'Знания', filterEntity: 'Сущности', filterConcept: 'Концепции', filterSynthesis: 'Синтез', @@ -4317,8 +4319,6 @@ export default { fileTypeText: 'Текстовые файлы', fileTypeJson: 'Файлы JSON', fileTypeImage: 'Изображения', - fileTypeEbook: 'Электронные книги', - fileTypeWebArchive: 'Веб-архивы', fileTypeAudiovisual: 'Аудио', engines: { builtin: { diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 65fd93b2..cfd1caf1 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -3384,7 +3384,9 @@ export default { searchNoResults: "没有找到匹配的页面", loadMore: "加载更多(还剩 {remaining} 条)", filterAll: "全部类型", + loadMoreFolders: "加载更多目录", filterSummary: "摘要", + filterKnowledge: "知识", filterEntity: "实体", filterConcept: "概念", filterSynthesis: "综合", @@ -4780,8 +4782,6 @@ export default { fileTypeText: "纯文本", fileTypeJson: "JSON 文件", fileTypeImage: "图片", - fileTypeEbook: "电子书", - fileTypeWebArchive: "网页存档", fileTypeAudiovisual: "音频", engines: { builtin: { diff --git a/frontend/src/views/knowledge/wiki/WikiBrowser.vue b/frontend/src/views/knowledge/wiki/WikiBrowser.vue index ffbd3208..eb36cf42 100644 --- a/frontend/src/views/knowledge/wiki/WikiBrowser.vue +++ b/frontend/src/views/knowledge/wiki/WikiBrowser.vue @@ -290,32 +290,64 @@