feat: Implement comprehensive wiki feature for knowledge bases

This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes:

**Backend Changes:**
- Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log)
- Database schema: wiki_pages table with full migration support
- WikiPageService: CRUD operations and page management
- WikiPageRepository: GORM-based persistence layer
- Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents
  * Summary page generation using LLM
  * Entity and concept extraction in a single LLM call
  * Synthesis opportunity detection
  * Index page rebuilding
  * Log page maintenance
- Wiki boost feature: Enhance chat retrieval with wiki context
- Wiki linting: Maintenance and validation utilities
- Agent wiki tools: Enable agents to query and interact with wiki pages
- Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks
- Language support: Reuse existing middleware language infrastructure for LLM prompts

**Frontend Changes:**
- Wiki browser UI: View all wiki pages with filtering and search
- Wiki API client: Knowledge base wiki management endpoints
- Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model)
- i18n updates: Support for English, Korean, Russian, and Chinese interfaces

**Configuration:**
- Container DI: Wire up all wiki services
- Router: Register wiki API endpoints
- Task handling: Support async wiki ingest tasks

**Testing:**
- Unit tests for wiki page types
- Service layer tests
- Endpoint tests for wiki operations
- Integration tests with LLM mocking

**Documentation:**
- Language refactoring analysis and guides
- Implementation completion reports
- Quick reference guides for developers

**Key Features:**
✅ LLM-powered wiki page generation from documents
✅ Multi-language support (9+ languages)
✅ Automatic extraction of entities and concepts
✅ Synthesis opportunity detection
✅ Index and log page maintenance
✅ Progressive wiki building across multiple documents
✅ Agent-based wiki interaction
✅ Chat retrieval enhancement with wiki context
✅ Full frontend UI for wiki browsing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wizardchen
2026-04-07 13:56:13 +08:00
parent e066f808b6
commit e147209e77
44 changed files with 7375 additions and 31 deletions
+15 -1
View File
@@ -1574,6 +1574,7 @@ export default {
storage: 'Storage Engine',
advanced: 'Advanced Settings',
faq: 'FAQ Settings',
wiki: 'Wiki Settings',
graph: 'Knowledge Graph',
multimodal: 'Image Processing',
asr: 'Audio',
@@ -1586,12 +1587,25 @@ export default {
typeLabel: 'Knowledge Base Type',
typeDocument: 'Document-based',
typeFAQ: 'FAQ Q&A',
typeDescription: 'FAQ suits structured Q&A datasets; document type supports file parsing and chunking.',
typeWiki: 'Wiki',
typeDescription: 'FAQ suits structured Q&A datasets; document type supports file parsing and chunking; Wiki type auto-builds interlinked knowledge pages via LLM.',
nameLabel: 'Knowledge Base Name',
namePlaceholder: 'Enter knowledge base name',
descriptionLabel: 'Knowledge Base Description',
descriptionPlaceholder: 'Enter knowledge base description (optional)'
},
wiki: {
title: 'Wiki Settings',
description: 'Configure Wiki knowledge base auto-generation and language preferences',
autoIngestLabel: 'Auto Ingest',
autoIngestTip: 'When enabled, uploading new documents automatically triggers Wiki page generation/update',
synthesisModelLabel: 'Synthesis Model',
synthesisModelPlaceholder: 'Select the LLM model for Wiki generation',
synthesisModelTip: 'Falls back to the summary model if not set',
languageLabel: 'Wiki Language',
maxPagesLabel: 'Max Pages Per Ingest',
maxPagesTip: 'Maximum number of pages to create/update per ingest (0 = no limit)',
},
buttons: {
create: 'Create Knowledge Base',
save: 'Save Configuration'
+16 -1
View File
@@ -2095,6 +2095,8 @@ export default {
chunking: "청크 설정",
advanced: "고급 설정",
faq: "FAQ 설정",
wiki: "Wiki 설정",
wiki: "Wiki 설정",
graph: "지식 그래프",
multimodal: "이미지 처리",
asr: "오디오",
@@ -2108,13 +2110,26 @@ export default {
typeLabel: "지식베이스 유형",
typeDocument: "문서",
typeFAQ: "Q&A",
typeWiki: "Wiki",
typeDescription:
"FAQ 유형은 구조화된 Q&A 데이터에 적합합니다. 문서 유형은 파일 파싱과 청킹을 지원합니다.",
"FAQ 유형은 구조화된 Q&A 데이터에 적합합니다. 문서 유형은 파일 파싱과 청킹을 지원합니다. Wiki 유형은 LLM을 통해 상호 연결된 지식 페이지를 자동으로 구축합니다.",
nameLabel: "지식베이스 이름",
namePlaceholder: "지식베이스 이름을 입력해주세요",
descriptionLabel: "지식베이스 설명",
descriptionPlaceholder: "지식베이스 설명을 입력해주세요 (선택)",
},
wiki: {
title: "Wiki 설정",
description: "Wiki 지식베이스의 자동 생성 및 언어 환경설정을 구성합니다",
autoIngestLabel: "자동 Ingest",
autoIngestTip: "활성화하면 새 문서 업로드 시 자동으로 Wiki 페이지가 생성/업데이트됩니다",
synthesisModelLabel: "합성 모델",
synthesisModelPlaceholder: "Wiki 생성에 사용할 LLM 모델을 선택하세요",
synthesisModelTip: "설정하지 않으면 요약 모델로 대체됩니다",
languageLabel: "Wiki 언어",
maxPagesLabel: "Ingest당 최대 페이지 수",
maxPagesTip: "Ingest당 생성/업데이트할 최대 페이지 수 (0 = 제한 없음)",
},
buttons: {
create: "지식베이스 생성",
save: "설정 저장",
+16 -1
View File
@@ -1775,6 +1775,8 @@ export default {
chunking: 'Настройки разбиения',
advanced: 'Дополнительные настройки',
faq: 'FAQ настройки',
wiki: 'Wiki настройки',
wiki: 'Wiki настройки',
graph: 'Граф знаний',
multimodal: 'Обработка изображений',
asr: 'Аудио',
@@ -1788,12 +1790,25 @@ export default {
typeLabel: 'Тип базы знаний',
typeDocument: 'Документальная',
typeFAQ: 'FAQ (вопрос-ответ)',
typeDescription: 'FAQ подходит для структурированных Q&A; документальный тип поддерживает загрузку файлов и разбиение.',
typeWiki: 'Wiki',
typeDescription: 'FAQ подходит для структурированных Q&A; документальный тип поддерживает загрузку файлов и разбиение; Wiki автоматически создает связанные страницы знаний через LLM.',
nameLabel: 'Название базы знаний',
namePlaceholder: 'Введите название базы знаний',
descriptionLabel: 'Описание базы знаний',
descriptionPlaceholder: 'Введите описание базы знаний (необязательно)'
},
wiki: {
title: 'Wiki настройки',
description: 'Настройте автоматическую генерацию и язык Wiki',
autoIngestLabel: 'Автоматический Ingest',
autoIngestTip: 'При загрузке новых документов автоматически создаются/обновляются Wiki-страницы',
synthesisModelLabel: 'Модель синтеза',
synthesisModelPlaceholder: 'Выберите LLM модель для генерации Wiki',
synthesisModelTip: 'Если не указано, используется модель суммаризации',
languageLabel: 'Язык Wiki',
maxPagesLabel: 'Макс. страниц за Ingest',
maxPagesTip: 'Максимальное количество страниц для создания/обновления за одну операцию (0 = без ограничения)',
},
buttons: {
create: 'Создать базу знаний',
save: 'Сохранить настройки'
+15 -1
View File
@@ -2081,6 +2081,7 @@ export default {
storage: "存储引擎",
advanced: "高级设置",
faq: "FAQ 设置",
wiki: "Wiki 设置",
graph: "知识图谱",
multimodal: "图像处理",
asr: "音频处理",
@@ -2093,12 +2094,25 @@ export default {
typeLabel: "知识库类型",
typeDocument: "文档",
typeFAQ: "问答",
typeDescription: "FAQ 类型适合结构化问答数据;文档型支持文件解析与分块。",
typeWiki: "Wiki",
typeDescription: "FAQ 类型适合结构化问答数据;文档型支持文件解析与分块;Wiki 类型由 LLM 自动构建互链知识页面。",
nameLabel: "知识库名称",
namePlaceholder: "请输入知识库名称",
descriptionLabel: "知识库描述",
descriptionPlaceholder: "请输入知识库描述(可选)",
},
wiki: {
title: "Wiki 设置",
description: "配置 Wiki 知识库的自动生成和语言偏好",
autoIngestLabel: "自动 Ingest",
autoIngestTip: "开启后,新文档上传后自动触发 Wiki 页面生成/更新",
synthesisModelLabel: "合成模型",
synthesisModelPlaceholder: "选择用于 Wiki 生成的 LLM 模型",
synthesisModelTip: "不设置时将回退使用摘要模型",
languageLabel: "Wiki 语言",
maxPagesLabel: "单次最大页面数",
maxPagesTip: "每次 Ingest 最多创建/更新的页面数(0 表示不限制)",
},
buttons: {
create: "创建知识库",
save: "保存配置",