Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat: Add warning message for disabled knowledge graph database and provide guidance on enabling it

begoniezhao9c3d4ec92225
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 9a8c4e32d..fb788f996 100644
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -315,6 +315,8 @@ export default {
extractFailed: 'Entity-relationship extraction failed',
exampleLoaded: 'Example loaded',
exampleCleared: 'Example cleared',
+ disabledWarning: 'Knowledge graph database is not enabled, entity-relationship extraction will not be available',
+ howToEnable: 'How to enable knowledge graph?',
saveSuccess: 'Graph configuration saved',
saveFailed: 'Failed to save configuration: {message}',
errors: {
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 3b64857bc..4d94ef825 100644
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -314,6 +314,8 @@ export default {
extractFailed: 'Не удалось извлечь сущности и отношения',
exampleLoaded: 'Пример загружен',
exampleCleared: 'Пример очищен',
+ disabledWarning: 'База данных графа знаний не включена, извлечение сущностей и отношений будет недоступно',
+ howToEnable: 'Как включить граф знаний?',
saveSuccess: 'Настройки графа сохранены',
saveFailed: 'Не удалось сохранить настройки: {message}',
errors: {
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 78bfea272..3f739831e 100644
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -417,6 +417,8 @@ export default {
extractFailed: "实体关系提取失败",
exampleLoaded: "示例已加载",
exampleCleared: "示例已清除",
+ disabledWarning: "知识图谱数据库未启用,实体关系提取功能将无法使用",
+ howToEnable: "如何启用知识图谱?",
saveSuccess: "图谱配置已保存",
saveFailed: "保存配置失败: {message}",
errors: {
diff --git a/frontend/src/views/knowledge/settings/GraphSettings.vue b/frontend/src/views/knowledge/settings/GraphSettings.vue
index 28c78b9fe..b5904dfd4 100644
--- a/frontend/src/views/knowledge/settings/GraphSettings.vue
+++ b/frontend/src/views/knowledge/settings/GraphSettings.vue
@@ -3,6 +3,20 @@
<div class="section-header">
<h2>{{ t('graphSettings.title') }}</h2>
<p class="section-description">{{ t('graphSettings.description') }}</p>
+
+ <!-- Warning message when graph database is not enabled -->
+ <t-alert
+ v-if="!isGraphDatabaseEnabled"
+ theme="warning"
+ style="margin-top: 16px;"
+ >
+ <template #message>
+ <div>{{ t('graphSettings.disabledWarning') }}</div>
+ <t-link class="graph-guide-link" theme="primary" @click="handleOpenGraphGuide">
+ {{ t('graphSettings.howToEnable') }}
+ </t-link>
+ </template>
+ </t-alert>
</div>
<div class="settings-group">
@@ -279,11 +293,12 @@
</template>
<script setup lang="ts">
-import { ref, watch, onMounted } from 'vue'
+import { ref, watch, onMounted, computed } from 'vue'
import { MessagePlugin } from 'tdesign-vue-next'
import { useI18n } from 'vue-i18n'
import { extractTextRelations, fabriText, fabriTag, type Node, type Relation, type LLMConfig } from '@/api/initialization'
import { listModels } from '@/api/model'
+import { getSystemInfo } from '@/api/system'
const { t } = useI18n()
@@ -326,6 +341,14 @@ const modelStatus = ref({
}
})
+// 系统信息
+const systemInfo = ref<any>(null)
+
+// 计算图数据库是否启用
+const isGraphDatabaseEnabled = computed(() => {
+ return systemInfo.value?.graph_database_engine && systemInfo.value.graph_database_engine !== '未启用'
+})
+
// Watch for prop changes
watch(() => props.graphExtract, (newVal) => {
localGraphExtract.value = {
@@ -542,9 +565,31 @@ const loadModelStatus = async () => {
}
}
+// 加载系统信息
+const loadSystemInfo = async () => {
+ try {
+ const response = await getSystemInfo()
+ systemInfo.value = response.data
+ } catch (error: any) {
+ console.error('Failed to load system info:', error)
+ }
+}
+
+const graphGuideUrl =
+ import.meta.env.VITE_KG_GUIDE_URL ||
+ 'https://github.com/Tencent/WeKnora/blob/main/docs/KnowledgeGraph.md'
+
+// Open guide documentation to show how to enable graph database
+const handleOpenGraphGuide = () => {
+ window.open(graphGuideUrl, '_blank', 'noopener')
+}
+
// 初始化
onMounted(async () => {
- await loadModelStatus()
+ await Promise.all([
+ loadModelStatus(),
+ loadSystemInfo()
+ ])
})
</script>