feat: Add Graph Settings component for managing graph extraction configurations
This commit is contained in:
@@ -128,16 +128,24 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 图谱设置 -->
|
||||
<div v-if="!isFAQ" v-show="currentSection === 'graph'" class="section">
|
||||
<GraphSettings
|
||||
v-if="formData"
|
||||
:graph-extract="formData.extractConfig"
|
||||
:all-models="allModels"
|
||||
@update:graphExtract="handleNodeExtractUpdate"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 高级设置 -->
|
||||
<div v-if="!isFAQ" v-show="currentSection === 'advanced'" class="section">
|
||||
<KBAdvancedSettings
|
||||
ref="advancedSettingsRef"
|
||||
v-if="formData"
|
||||
:multimodal="formData.multimodalConfig"
|
||||
:node-extract="formData.nodeExtractConfig"
|
||||
:all-models="allModels"
|
||||
@update:multimodal="handleMultimodalUpdate"
|
||||
@update:nodeExtract="handleNodeExtractUpdate"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -169,6 +177,7 @@ import { useUIStore } from '@/stores/ui'
|
||||
import KBModelConfig from './settings/KBModelConfig.vue'
|
||||
import KBChunkingSettings from './settings/KBChunkingSettings.vue'
|
||||
import KBAdvancedSettings from './settings/KBAdvancedSettings.vue'
|
||||
import GraphSettings from './settings/GraphSettings.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const uiStore = useUIStore()
|
||||
@@ -204,6 +213,7 @@ const navItems = computed(() => {
|
||||
} else {
|
||||
items.push(
|
||||
{ key: 'chunking', icon: 'file-copy', label: t('knowledgeEditor.sidebar.chunking') },
|
||||
{ key: 'graph', icon: 'chart-bubble', label: t('knowledgeEditor.sidebar.graph') },
|
||||
{ key: 'advanced', icon: 'setting', label: t('knowledgeEditor.sidebar.advanced') }
|
||||
)
|
||||
}
|
||||
@@ -272,13 +282,12 @@ const initFormData = (type: 'document' | 'faq' = 'document') => {
|
||||
pathPrefix: ''
|
||||
}
|
||||
},
|
||||
nodeExtractConfig: {
|
||||
extractConfig: {
|
||||
enabled: false,
|
||||
text: '',
|
||||
tags: [] as string[],
|
||||
nodes: [] as Array<{
|
||||
name: string
|
||||
chunks: string[]
|
||||
attributes: string[]
|
||||
}>,
|
||||
relations: [] as Array<{
|
||||
@@ -286,7 +295,7 @@ const initFormData = (type: 'document' | 'faq' = 'document') => {
|
||||
node2: string
|
||||
type: string
|
||||
}>
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,13 +367,16 @@ const loadKBData = async () => {
|
||||
pathPrefix: kb.cos_config?.path_prefix || ''
|
||||
}
|
||||
},
|
||||
nodeExtractConfig: {
|
||||
extractConfig: {
|
||||
enabled: kb.extract_config?.enabled || false,
|
||||
text: kb.extract_config?.text || '',
|
||||
tags: kb.extract_config?.tags || [],
|
||||
nodes: kb.extract_config?.nodes || [],
|
||||
nodes: (kb.extract_config?.nodes || []).map((node: any) => ({
|
||||
name: node.name,
|
||||
attributes: node.attributes || []
|
||||
})),
|
||||
relations: kb.extract_config?.relations || []
|
||||
}
|
||||
},
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load knowledge base data:', error)
|
||||
@@ -396,7 +408,7 @@ const handleMultimodalUpdate = (config: any) => {
|
||||
|
||||
const handleNodeExtractUpdate = (config: any) => {
|
||||
if (formData.value) {
|
||||
formData.value.nodeExtractConfig = { ...config }
|
||||
formData.value.extractConfig = { ...config }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,13 +504,13 @@ const buildSubmitData = () => {
|
||||
}
|
||||
|
||||
// 添加知识图谱配置
|
||||
if (formData.value.nodeExtractConfig.enabled) {
|
||||
if (formData.value.extractConfig.enabled) {
|
||||
data.extract_config = {
|
||||
enabled: true,
|
||||
text: formData.value.nodeExtractConfig.text,
|
||||
tags: formData.value.nodeExtractConfig.tags,
|
||||
nodes: formData.value.nodeExtractConfig.nodes,
|
||||
relations: formData.value.nodeExtractConfig.relations
|
||||
text: formData.value.extractConfig.text,
|
||||
tags: formData.value.extractConfig.tags,
|
||||
nodes: formData.value.extractConfig.nodes,
|
||||
relations: formData.value.extractConfig.relations
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,8 +596,8 @@ const handleSubmit = async () => {
|
||||
enabled: data.extract_config?.enabled || false,
|
||||
text: data.extract_config?.text || '',
|
||||
tags: data.extract_config?.tags || [],
|
||||
nodes: [],
|
||||
relations: []
|
||||
nodes: data.extract_config?.nodes || [],
|
||||
relations: data.extract_config?.relations || []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user