feat: Add warning message for disabled knowledge graph database and provide guidance on enabling it
This commit is contained in:
@@ -315,6 +315,8 @@ export default {
|
|||||||
extractFailed: 'Entity-relationship extraction failed',
|
extractFailed: 'Entity-relationship extraction failed',
|
||||||
exampleLoaded: 'Example loaded',
|
exampleLoaded: 'Example loaded',
|
||||||
exampleCleared: 'Example cleared',
|
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',
|
saveSuccess: 'Graph configuration saved',
|
||||||
saveFailed: 'Failed to save configuration: {message}',
|
saveFailed: 'Failed to save configuration: {message}',
|
||||||
errors: {
|
errors: {
|
||||||
|
|||||||
@@ -314,6 +314,8 @@ export default {
|
|||||||
extractFailed: 'Не удалось извлечь сущности и отношения',
|
extractFailed: 'Не удалось извлечь сущности и отношения',
|
||||||
exampleLoaded: 'Пример загружен',
|
exampleLoaded: 'Пример загружен',
|
||||||
exampleCleared: 'Пример очищен',
|
exampleCleared: 'Пример очищен',
|
||||||
|
disabledWarning: 'База данных графа знаний не включена, извлечение сущностей и отношений будет недоступно',
|
||||||
|
howToEnable: 'Как включить граф знаний?',
|
||||||
saveSuccess: 'Настройки графа сохранены',
|
saveSuccess: 'Настройки графа сохранены',
|
||||||
saveFailed: 'Не удалось сохранить настройки: {message}',
|
saveFailed: 'Не удалось сохранить настройки: {message}',
|
||||||
errors: {
|
errors: {
|
||||||
|
|||||||
@@ -417,6 +417,8 @@ export default {
|
|||||||
extractFailed: "实体关系提取失败",
|
extractFailed: "实体关系提取失败",
|
||||||
exampleLoaded: "示例已加载",
|
exampleLoaded: "示例已加载",
|
||||||
exampleCleared: "示例已清除",
|
exampleCleared: "示例已清除",
|
||||||
|
disabledWarning: "知识图谱数据库未启用,实体关系提取功能将无法使用",
|
||||||
|
howToEnable: "如何启用知识图谱?",
|
||||||
saveSuccess: "图谱配置已保存",
|
saveSuccess: "图谱配置已保存",
|
||||||
saveFailed: "保存配置失败: {message}",
|
saveFailed: "保存配置失败: {message}",
|
||||||
errors: {
|
errors: {
|
||||||
|
|||||||
@@ -3,6 +3,20 @@
|
|||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<h2>{{ t('graphSettings.title') }}</h2>
|
<h2>{{ t('graphSettings.title') }}</h2>
|
||||||
<p class="section-description">{{ t('graphSettings.description') }}</p>
|
<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>
|
||||||
|
|
||||||
<div class="settings-group">
|
<div class="settings-group">
|
||||||
@@ -279,11 +293,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, onMounted } from 'vue'
|
import { ref, watch, onMounted, computed } from 'vue'
|
||||||
import { MessagePlugin } from 'tdesign-vue-next'
|
import { MessagePlugin } from 'tdesign-vue-next'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { extractTextRelations, fabriText, fabriTag, type Node, type Relation, type LLMConfig } from '@/api/initialization'
|
import { extractTextRelations, fabriText, fabriTag, type Node, type Relation, type LLMConfig } from '@/api/initialization'
|
||||||
import { listModels } from '@/api/model'
|
import { listModels } from '@/api/model'
|
||||||
|
import { getSystemInfo } from '@/api/system'
|
||||||
|
|
||||||
const { t } = useI18n()
|
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 for prop changes
|
||||||
watch(() => props.graphExtract, (newVal) => {
|
watch(() => props.graphExtract, (newVal) => {
|
||||||
localGraphExtract.value = {
|
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 () => {
|
onMounted(async () => {
|
||||||
await loadModelStatus()
|
await Promise.all([
|
||||||
|
loadModelStatus(),
|
||||||
|
loadSystemInfo()
|
||||||
|
])
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user