From da5f71dfd35564590db1dda95d305bf346927831 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Mon, 17 Nov 2025 11:38:02 +0800 Subject: [PATCH] feat: Add MinIO and graph database status handling with localization updates - Introduced a new boolean field for MinIO status in the system info API response. - Updated localization files in English, Russian, and Chinese to include warnings and instructions related to MinIO and graph database configurations. - Enhanced the KBAdvancedSettings component to display alerts and disable options based on the status of MinIO and graph database. - Implemented logic to check system status on component mount and adjust settings accordingly. --- frontend/src/api/system/index.ts | 1 + frontend/src/i18n/locales/en-US.ts | 5 +- frontend/src/i18n/locales/ru-RU.ts | 5 +- frontend/src/i18n/locales/zh-CN.ts | 3 + .../knowledge/components/FAQEntryManager.vue | 2 +- .../knowledge/settings/KBAdvancedSettings.vue | 98 ++++++++++++++++++- internal/application/service/knowledge.go | 4 + internal/application/service/knowledgebase.go | 24 ++--- internal/handler/system.go | 15 +++ 9 files changed, 136 insertions(+), 21 deletions(-) diff --git a/frontend/src/api/system/index.ts b/frontend/src/api/system/index.ts index 49af717cc..97e70fd5e 100644 --- a/frontend/src/api/system/index.ts +++ b/frontend/src/api/system/index.ts @@ -8,6 +8,7 @@ export interface SystemInfo { keyword_index_engine?: string vector_store_engine?: string graph_database_engine?: string + minio_enabled?: boolean } export interface ToolDefinition { diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 2d56bf1ea..29e0841a1 100644 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -847,6 +847,7 @@ export default { minio: 'MinIO', cos: 'Tencent Cloud COS' }, + minioDisabledWarning: 'MinIO is not enabled. Automatically switched to Tencent Cloud COS. To use MinIO, please enable it in system configuration first.', minio: { bucketLabel: 'Bucket Name', bucketDescription: 'Name of the MinIO bucket (required)', @@ -887,7 +888,9 @@ export default { promptPlaceholder: 'Enter prompt text', tagsLabel: 'Tags', tagsDescription: 'Predefined entity tags (separate multiple tags with commas)', - tagsPlaceholder: 'Enter a tag and press Enter' + tagsPlaceholder: 'Enter a tag and press Enter', + disabledWarning: 'Graph database is not enabled. Please enable the graph database first to use this feature.', + howToEnable: 'How to enable' } } }, diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 2d853e51c..ab542925c 100644 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -938,6 +938,7 @@ export default { minio: 'MinIO', cos: 'Tencent Cloud COS' }, + minioDisabledWarning: 'MinIO не включен. Автоматически переключено на Tencent Cloud COS. Чтобы использовать MinIO, сначала включите его в конфигурации системы.', minio: { bucketLabel: 'Имя Bucket', bucketDescription: 'Название бакета MinIO (обязательно)', @@ -978,7 +979,9 @@ export default { promptPlaceholder: 'Введите текст подсказки', tagsLabel: 'Теги', tagsDescription: 'Предопределённые теги сущностей (несколько тегов разделяйте запятыми)', - tagsPlaceholder: 'Введите тег и нажмите Enter' + tagsPlaceholder: 'Введите тег и нажмите Enter', + disabledWarning: 'Графовая база данных не включена. Пожалуйста, сначала включите графовую базу данных, чтобы использовать эту функцию.', + howToEnable: 'Как включить' } } }, diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 4cd8835b4..ef48ca032 100644 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1171,6 +1171,7 @@ export default { minio: "MinIO", cos: "腾讯云 COS", }, + minioDisabledWarning: "MinIO 未启用,已自动切换到腾讯云 COS。如需使用 MinIO,请先在系统配置中启用 MinIO。", minio: { bucketLabel: "Bucket 名称", bucketDescription: "MinIO 存储桶名称(必填)", @@ -1212,6 +1213,8 @@ export default { tagsLabel: "标签", tagsDescription: "预定义的实体标签(多个标签用逗号分隔)", tagsPlaceholder: "输入标签后按回车", + disabledWarning: "图数据库未启用,无法使用知识图谱功能。请先启用图数据库后再使用此功能。", + howToEnable: "查看如何开启", }, }, }, diff --git a/frontend/src/views/knowledge/components/FAQEntryManager.vue b/frontend/src/views/knowledge/components/FAQEntryManager.vue index 23f1cfc65..7b4617139 100644 --- a/frontend/src/views/knowledge/components/FAQEntryManager.vue +++ b/frontend/src/views/knowledge/components/FAQEntryManager.vue @@ -424,7 +424,7 @@
- + {{ $t('knowledgeEditor.faqImport.appendMode') }} {{ $t('knowledgeEditor.faqImport.replaceMode') }} diff --git a/frontend/src/views/knowledge/settings/KBAdvancedSettings.vue b/frontend/src/views/knowledge/settings/KBAdvancedSettings.vue index fdbb39c09..f8f5beae1 100644 --- a/frontend/src/views/knowledge/settings/KBAdvancedSettings.vue +++ b/frontend/src/views/knowledge/settings/KBAdvancedSettings.vue @@ -50,10 +50,19 @@

{{ $t('knowledgeEditor.advanced.multimodal.storageTypeDescription') }}

+ +
- {{ $t('knowledgeEditor.advanced.multimodal.storageTypeOptions.minio') }} + + {{ $t('knowledgeEditor.advanced.multimodal.storageTypeOptions.minio') }} + {{ $t('knowledgeEditor.advanced.multimodal.storageTypeOptions.cos') }}
@@ -206,18 +215,32 @@

{{ $t('knowledgeEditor.advanced.graph.description') }}

+ + + +
-
+

{{ $t('knowledgeEditor.advanced.graph.configTitle') }}

@@ -258,9 +281,10 @@