2025-11-06 13:12:26 +00:00
|
|
|
|
<template>
|
|
|
|
|
|
<Teleport to="body">
|
|
|
|
|
|
<Transition name="modal">
|
|
|
|
|
|
<div v-if="visible" class="settings-overlay" @click.self="handleClose">
|
|
|
|
|
|
<div class="settings-modal">
|
|
|
|
|
|
<!-- 关闭按钮 -->
|
2025-11-13 11:34:33 +00:00
|
|
|
|
<button class="close-btn" @click="handleClose" :aria-label="$t('general.close')">
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
|
|
|
|
<path d="M15 5L5 15M5 5L15 15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="settings-container">
|
|
|
|
|
|
<!-- 左侧导航 -->
|
|
|
|
|
|
<div class="settings-sidebar">
|
|
|
|
|
|
<div class="sidebar-header">
|
2025-11-13 11:34:33 +00:00
|
|
|
|
<h2 class="sidebar-title">{{ mode === 'create' ? $t('knowledgeEditor.titleCreate') : $t('knowledgeEditor.titleEdit') }}</h2>
|
2025-11-06 13:12:26 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="settings-nav">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="(item, index) in navItems"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
:class="['nav-item', { 'active': currentSection === item.key }]"
|
|
|
|
|
|
@click="currentSection = item.key"
|
|
|
|
|
|
>
|
2025-11-06 15:13:13 +00:00
|
|
|
|
<t-icon :name="item.icon" class="nav-icon" />
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<span class="nav-label">{{ item.label }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 右侧内容区域 -->
|
|
|
|
|
|
<div class="settings-content">
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
|
<!-- 基本信息 -->
|
|
|
|
|
|
<div v-show="currentSection === 'basic'" class="section">
|
|
|
|
|
|
<div v-if="formData" class="section-content">
|
|
|
|
|
|
<div class="section-header">
|
2025-11-13 11:34:33 +00:00
|
|
|
|
<h3 class="section-title">{{ $t('knowledgeEditor.basic.title') }}</h3>
|
|
|
|
|
|
<p class="section-desc">{{ $t('knowledgeEditor.basic.description') }}</p>
|
2025-11-06 13:12:26 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="section-body">
|
2025-11-14 17:30:17 +00:00
|
|
|
|
<div class="form-item">
|
|
|
|
|
|
<label class="form-label required">{{ $t('knowledgeEditor.basic.typeLabel') }}</label>
|
|
|
|
|
|
<t-radio-group
|
|
|
|
|
|
v-model="formData.type"
|
|
|
|
|
|
:disabled="mode === 'edit'"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-radio-button value="document">{{ $t('knowledgeEditor.basic.typeDocument') }}</t-radio-button>
|
|
|
|
|
|
<t-radio-button value="faq">{{ $t('knowledgeEditor.basic.typeFAQ') }}</t-radio-button>
|
|
|
|
|
|
</t-radio-group>
|
|
|
|
|
|
<p class="form-tip">{{ $t('knowledgeEditor.basic.typeDescription') }}</p>
|
|
|
|
|
|
</div>
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<div class="form-item">
|
2025-11-13 11:34:33 +00:00
|
|
|
|
<label class="form-label required">{{ $t('knowledgeEditor.basic.nameLabel') }}</label>
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<t-input
|
|
|
|
|
|
v-model="formData.name"
|
2025-11-13 11:34:33 +00:00
|
|
|
|
:placeholder="$t('knowledgeEditor.basic.namePlaceholder')"
|
2025-11-06 13:12:26 +00:00
|
|
|
|
:maxlength="50"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-item">
|
2025-11-13 11:34:33 +00:00
|
|
|
|
<label class="form-label">{{ $t('knowledgeEditor.basic.descriptionLabel') }}</label>
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<t-textarea
|
|
|
|
|
|
v-model="formData.description"
|
2025-11-13 11:34:33 +00:00
|
|
|
|
:placeholder="$t('knowledgeEditor.basic.descriptionPlaceholder')"
|
2025-11-06 13:12:26 +00:00
|
|
|
|
:maxlength="200"
|
|
|
|
|
|
:autosize="{ minRows: 3, maxRows: 6 }"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 模型配置 -->
|
|
|
|
|
|
<div v-show="currentSection === 'models'" class="section">
|
|
|
|
|
|
<KBModelConfig
|
|
|
|
|
|
ref="modelConfigRef"
|
|
|
|
|
|
v-if="formData"
|
|
|
|
|
|
:config="formData.modelConfig"
|
|
|
|
|
|
:has-files="hasFiles"
|
|
|
|
|
|
:all-models="allModels"
|
|
|
|
|
|
@update:config="handleModelConfigUpdate"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-14 17:30:17 +00:00
|
|
|
|
<!-- FAQ 配置 -->
|
|
|
|
|
|
<div v-if="isFAQ && formData" v-show="currentSection === 'faq'" class="section">
|
|
|
|
|
|
<div class="section-content">
|
|
|
|
|
|
<div class="section-header">
|
|
|
|
|
|
<h3 class="section-title">{{ $t('knowledgeEditor.faq.title') }}</h3>
|
|
|
|
|
|
<p class="section-desc">{{ $t('knowledgeEditor.faq.description') }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="section-body">
|
|
|
|
|
|
<div class="form-item">
|
|
|
|
|
|
<label class="form-label required">{{ $t('knowledgeEditor.faq.indexModeLabel') }}</label>
|
|
|
|
|
|
<t-radio-group
|
|
|
|
|
|
v-model="formData.faqConfig.indexMode"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-radio-button value="question_only">{{ $t('knowledgeEditor.faq.modes.questionOnly') }}</t-radio-button>
|
|
|
|
|
|
<t-radio-button value="question_answer">{{ $t('knowledgeEditor.faq.modes.questionAnswer') }}</t-radio-button>
|
|
|
|
|
|
</t-radio-group>
|
|
|
|
|
|
<p class="form-tip">{{ $t('knowledgeEditor.faq.indexModeDescription') }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-item">
|
|
|
|
|
|
<label class="form-label required">{{ $t('knowledgeEditor.faq.questionIndexModeLabel') }}</label>
|
|
|
|
|
|
<t-radio-group
|
|
|
|
|
|
v-model="formData.faqConfig.questionIndexMode"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-radio-button value="combined">{{ $t('knowledgeEditor.faq.modes.combined') }}</t-radio-button>
|
|
|
|
|
|
<t-radio-button value="separate">{{ $t('knowledgeEditor.faq.modes.separate') }}</t-radio-button>
|
|
|
|
|
|
</t-radio-group>
|
|
|
|
|
|
<p class="form-tip">{{ $t('knowledgeEditor.faq.questionIndexModeDescription') }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="faq-guide">
|
|
|
|
|
|
<p>{{ $t('knowledgeEditor.faq.entryGuide') }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<!-- 分块设置 -->
|
2025-11-14 17:30:17 +00:00
|
|
|
|
<div v-if="!isFAQ" v-show="currentSection === 'chunking'" class="section">
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<KBChunkingSettings
|
|
|
|
|
|
v-if="formData"
|
|
|
|
|
|
:config="formData.chunkingConfig"
|
|
|
|
|
|
@update:config="handleChunkingConfigUpdate"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-25 08:44:44 +00:00
|
|
|
|
<!-- 图谱设置 -->
|
|
|
|
|
|
<div v-if="!isFAQ" v-show="currentSection === 'graph'" class="section">
|
|
|
|
|
|
<GraphSettings
|
|
|
|
|
|
v-if="formData"
|
2025-11-25 08:51:14 +00:00
|
|
|
|
:graph-extract="formData.nodeExtractConfig"
|
2025-11-25 08:44:44 +00:00
|
|
|
|
:all-models="allModels"
|
|
|
|
|
|
@update:graphExtract="handleNodeExtractUpdate"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<!-- 高级设置 -->
|
2025-11-14 17:30:17 +00:00
|
|
|
|
<div v-if="!isFAQ" v-show="currentSection === 'advanced'" class="section">
|
2025-11-06 13:12:26 +00:00
|
|
|
|
<KBAdvancedSettings
|
|
|
|
|
|
ref="advancedSettingsRef"
|
|
|
|
|
|
v-if="formData"
|
|
|
|
|
|
:multimodal="formData.multimodalConfig"
|
|
|
|
|
|
:all-models="allModels"
|
|
|
|
|
|
@update:multimodal="handleMultimodalUpdate"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 保存按钮 -->
|
|
|
|
|
|
<div class="settings-footer">
|
|
|
|
|
|
<t-button theme="default" variant="outline" @click="handleClose">
|
2025-11-13 11:34:33 +00:00
|
|
|
|
{{ $t('common.cancel') }}
|
2025-11-06 13:12:26 +00:00
|
|
|
|
</t-button>
|
|
|
|
|
|
<t-button theme="primary" @click="handleSubmit" :loading="saving">
|
2025-11-13 11:34:33 +00:00
|
|
|
|
{{ mode === 'create' ? $t('knowledgeEditor.buttons.create') : $t('knowledgeEditor.buttons.save') }}
|
2025-11-06 13:12:26 +00:00
|
|
|
|
</t-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Transition>
|
|
|
|
|
|
</Teleport>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { ref, computed, watch } from 'vue'
|
|
|
|
|
|
import { MessagePlugin } from 'tdesign-vue-next'
|
|
|
|
|
|
import { createKnowledgeBase, getKnowledgeBaseById, listKnowledgeFiles, updateKnowledgeBase } from '@/api/knowledge-base'
|
|
|
|
|
|
import { updateKBConfig, type KBModelConfigRequest } from '@/api/initialization'
|
|
|
|
|
|
import { listModels } from '@/api/model'
|
2025-11-07 08:40:53 +00:00
|
|
|
|
import { useUIStore } from '@/stores/ui'
|
2025-11-06 13:12:26 +00:00
|
|
|
|
import KBModelConfig from './settings/KBModelConfig.vue'
|
|
|
|
|
|
import KBChunkingSettings from './settings/KBChunkingSettings.vue'
|
|
|
|
|
|
import KBAdvancedSettings from './settings/KBAdvancedSettings.vue'
|
2025-11-25 08:44:44 +00:00
|
|
|
|
import GraphSettings from './settings/GraphSettings.vue'
|
2025-11-13 11:34:33 +00:00
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2025-11-06 13:12:26 +00:00
|
|
|
|
|
2025-11-07 08:40:53 +00:00
|
|
|
|
const uiStore = useUIStore()
|
2025-11-13 11:34:33 +00:00
|
|
|
|
const { t } = useI18n()
|
2025-11-07 08:40:53 +00:00
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
// Props
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
|
visible: boolean
|
|
|
|
|
|
mode: 'create' | 'edit'
|
|
|
|
|
|
kbId?: string
|
2025-11-14 17:30:17 +00:00
|
|
|
|
initialType?: 'document' | 'faq'
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
// Emits
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
|
(e: 'update:visible', value: boolean): void
|
|
|
|
|
|
(e: 'success', kbId: string): void
|
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
const currentSection = ref<string>('basic')
|
|
|
|
|
|
const saving = ref(false)
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const allModels = ref<any[]>([])
|
|
|
|
|
|
const hasFiles = ref(false)
|
|
|
|
|
|
|
2025-11-14 17:30:17 +00:00
|
|
|
|
const navItems = computed(() => {
|
|
|
|
|
|
const items = [
|
|
|
|
|
|
{ key: 'basic', icon: 'info-circle', label: t('knowledgeEditor.sidebar.basic') },
|
|
|
|
|
|
{ key: 'models', icon: 'control-platform', label: t('knowledgeEditor.sidebar.models') }
|
|
|
|
|
|
]
|
|
|
|
|
|
if (formData.value?.type === 'faq') {
|
|
|
|
|
|
items.push({ key: 'faq', icon: 'help-circle', label: t('knowledgeEditor.sidebar.faq') })
|
|
|
|
|
|
} else {
|
|
|
|
|
|
items.push(
|
|
|
|
|
|
{ key: 'chunking', icon: 'file-copy', label: t('knowledgeEditor.sidebar.chunking') },
|
2025-11-25 08:44:44 +00:00
|
|
|
|
{ key: 'graph', icon: 'chart-bubble', label: t('knowledgeEditor.sidebar.graph') },
|
2025-11-14 17:30:17 +00:00
|
|
|
|
{ key: 'advanced', icon: 'setting', label: t('knowledgeEditor.sidebar.advanced') }
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
return items
|
|
|
|
|
|
})
|
2025-11-06 13:12:26 +00:00
|
|
|
|
|
|
|
|
|
|
// 模型配置引用
|
|
|
|
|
|
const modelConfigRef = ref<InstanceType<typeof KBModelConfig>>()
|
|
|
|
|
|
const advancedSettingsRef = ref<InstanceType<typeof KBAdvancedSettings>>()
|
|
|
|
|
|
|
|
|
|
|
|
// 表单数据
|
|
|
|
|
|
const formData = ref<any>(null)
|
2025-11-14 17:30:17 +00:00
|
|
|
|
const isFAQ = computed(() => formData.value?.type === 'faq')
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => formData.value?.type,
|
|
|
|
|
|
(newType, oldType) => {
|
|
|
|
|
|
if (!formData.value) return
|
|
|
|
|
|
if (newType === 'faq') {
|
|
|
|
|
|
if (!formData.value.faqConfig) {
|
2025-11-16 15:35:54 +00:00
|
|
|
|
formData.value.faqConfig = { indexMode: 'question_only', questionIndexMode: 'separate' }
|
2025-11-14 17:30:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (!['basic', 'models', 'faq'].includes(currentSection.value)) {
|
|
|
|
|
|
currentSection.value = 'faq'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (oldType === 'faq' && currentSection.value === 'faq') {
|
|
|
|
|
|
currentSection.value = 'basic'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2025-11-06 13:12:26 +00:00
|
|
|
|
|
|
|
|
|
|
// 初始化表单数据
|
2025-11-14 17:30:17 +00:00
|
|
|
|
const initFormData = (type: 'document' | 'faq' = 'document') => {
|
2025-11-06 13:12:26 +00:00
|
|
|
|
return {
|
2025-11-14 17:30:17 +00:00
|
|
|
|
type,
|
2025-11-06 13:12:26 +00:00
|
|
|
|
name: '',
|
|
|
|
|
|
description: '',
|
2025-11-14 17:30:17 +00:00
|
|
|
|
faqConfig: {
|
2025-11-16 15:35:54 +00:00
|
|
|
|
indexMode: 'question_only',
|
|
|
|
|
|
questionIndexMode: 'separate'
|
2025-11-14 17:30:17 +00:00
|
|
|
|
},
|
2025-11-06 13:12:26 +00:00
|
|
|
|
modelConfig: {
|
|
|
|
|
|
llmModelId: '',
|
2025-11-19 17:03:19 +00:00
|
|
|
|
embeddingModelId: ''
|
2025-11-06 13:12:26 +00:00
|
|
|
|
},
|
|
|
|
|
|
chunkingConfig: {
|
|
|
|
|
|
chunkSize: 512,
|
|
|
|
|
|
chunkOverlap: 100,
|
|
|
|
|
|
separators: ['\n\n', '\n', '。', '!', '?', ';', ';']
|
|
|
|
|
|
},
|
|
|
|
|
|
multimodalConfig: {
|
|
|
|
|
|
enabled: false,
|
|
|
|
|
|
storageType: 'minio' as 'minio' | 'cos',
|
|
|
|
|
|
vllmModelId: '',
|
|
|
|
|
|
minio: {
|
|
|
|
|
|
bucketName: '',
|
|
|
|
|
|
useSSL: false,
|
|
|
|
|
|
pathPrefix: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
cos: {
|
|
|
|
|
|
secretId: '',
|
|
|
|
|
|
secretKey: '',
|
|
|
|
|
|
region: '',
|
|
|
|
|
|
bucketName: '',
|
|
|
|
|
|
appId: '',
|
|
|
|
|
|
pathPrefix: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-11-25 08:51:14 +00:00
|
|
|
|
nodeExtractConfig: {
|
2025-11-06 13:12:26 +00:00
|
|
|
|
enabled: false,
|
|
|
|
|
|
text: '',
|
2025-11-20 12:08:24 +00:00
|
|
|
|
tags: [] as string[],
|
|
|
|
|
|
nodes: [] as Array<{
|
|
|
|
|
|
name: string
|
|
|
|
|
|
attributes: string[]
|
|
|
|
|
|
}>,
|
|
|
|
|
|
relations: [] as Array<{
|
|
|
|
|
|
node1: string
|
|
|
|
|
|
node2: string
|
|
|
|
|
|
type: string
|
|
|
|
|
|
}>
|
2025-11-25 08:44:44 +00:00
|
|
|
|
},
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载所有模型
|
|
|
|
|
|
const loadAllModels = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const models = await listModels()
|
|
|
|
|
|
allModels.value = models || []
|
|
|
|
|
|
} catch (error) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
console.error('Failed to load model list:', error)
|
|
|
|
|
|
MessagePlugin.error(t('knowledgeEditor.messages.loadModelsFailed'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
allModels.value = []
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载知识库数据(编辑模式)
|
|
|
|
|
|
const loadKBData = async () => {
|
|
|
|
|
|
if (props.mode !== 'edit' || !props.kbId) return
|
|
|
|
|
|
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const [kbInfo, models, filesResult] = await Promise.all([
|
|
|
|
|
|
getKnowledgeBaseById(props.kbId),
|
|
|
|
|
|
loadAllModels(),
|
|
|
|
|
|
listKnowledgeFiles(props.kbId, { page: 1, page_size: 1 })
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
if (!kbInfo || !kbInfo.data) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
throw new Error(t('knowledgeEditor.messages.notFound'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const kb = kbInfo.data
|
|
|
|
|
|
hasFiles.value = (filesResult as any)?.total > 0
|
|
|
|
|
|
|
|
|
|
|
|
// 设置表单数据
|
2025-11-14 17:30:17 +00:00
|
|
|
|
const kbType = (kb.type as 'document' | 'faq') || 'document'
|
2025-11-06 13:12:26 +00:00
|
|
|
|
formData.value = {
|
2025-11-14 17:30:17 +00:00
|
|
|
|
type: kbType,
|
2025-11-06 13:12:26 +00:00
|
|
|
|
name: kb.name || '',
|
|
|
|
|
|
description: kb.description || '',
|
2025-11-14 17:30:17 +00:00
|
|
|
|
faqConfig: {
|
2025-11-16 15:35:54 +00:00
|
|
|
|
indexMode: kb.faq_config?.index_mode || 'question_only',
|
|
|
|
|
|
questionIndexMode: kb.faq_config?.question_index_mode || 'separate'
|
2025-11-14 17:30:17 +00:00
|
|
|
|
},
|
2025-11-06 13:12:26 +00:00
|
|
|
|
modelConfig: {
|
|
|
|
|
|
llmModelId: kb.summary_model_id || '',
|
2025-11-19 17:03:19 +00:00
|
|
|
|
embeddingModelId: kb.embedding_model_id || ''
|
2025-11-06 13:12:26 +00:00
|
|
|
|
},
|
|
|
|
|
|
chunkingConfig: {
|
|
|
|
|
|
chunkSize: kb.chunking_config?.chunk_size || 512,
|
|
|
|
|
|
chunkOverlap: kb.chunking_config?.chunk_overlap || 100,
|
|
|
|
|
|
separators: kb.chunking_config?.separators || ['\n\n', '\n', '。', '!', '?', ';', ';']
|
|
|
|
|
|
},
|
|
|
|
|
|
multimodalConfig: {
|
2025-11-20 12:08:24 +00:00
|
|
|
|
enabled: !!(kb.vlm_config?.enabled || (kb.cos_config?.provider && kb.cos_config?.bucket_name)),
|
2025-11-06 13:12:26 +00:00
|
|
|
|
storageType: (kb.cos_config?.provider || 'minio') as 'minio' | 'cos',
|
2025-11-20 12:08:24 +00:00
|
|
|
|
vllmModelId: kb.vlm_config?.model_id || '',
|
2025-11-06 13:12:26 +00:00
|
|
|
|
minio: {
|
|
|
|
|
|
bucketName: kb.cos_config?.bucket_name || '',
|
|
|
|
|
|
useSSL: kb.cos_config?.use_ssl || false,
|
|
|
|
|
|
pathPrefix: kb.cos_config?.path_prefix || ''
|
|
|
|
|
|
},
|
|
|
|
|
|
cos: {
|
|
|
|
|
|
secretId: kb.cos_config?.secret_id || '',
|
|
|
|
|
|
secretKey: kb.cos_config?.secret_key || '',
|
|
|
|
|
|
region: kb.cos_config?.region || '',
|
|
|
|
|
|
bucketName: kb.cos_config?.bucket_name || '',
|
|
|
|
|
|
appId: kb.cos_config?.app_id || '',
|
|
|
|
|
|
pathPrefix: kb.cos_config?.path_prefix || ''
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-11-25 08:51:14 +00:00
|
|
|
|
nodeExtractConfig: {
|
2025-11-06 13:12:26 +00:00
|
|
|
|
enabled: kb.extract_config?.enabled || false,
|
|
|
|
|
|
text: kb.extract_config?.text || '',
|
2025-11-20 12:08:24 +00:00
|
|
|
|
tags: kb.extract_config?.tags || [],
|
2025-11-25 08:44:44 +00:00
|
|
|
|
nodes: (kb.extract_config?.nodes || []).map((node: any) => ({
|
|
|
|
|
|
name: node.name,
|
|
|
|
|
|
attributes: node.attributes || []
|
|
|
|
|
|
})),
|
2025-11-20 12:08:24 +00:00
|
|
|
|
relations: kb.extract_config?.relations || []
|
2025-11-25 08:44:44 +00:00
|
|
|
|
},
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
console.error('Failed to load knowledge base data:', error)
|
|
|
|
|
|
MessagePlugin.error(t('knowledgeEditor.messages.loadDataFailed'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
handleClose()
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理配置更新
|
|
|
|
|
|
const handleModelConfigUpdate = (config: any) => {
|
|
|
|
|
|
if (formData.value) {
|
|
|
|
|
|
formData.value.modelConfig = { ...config }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleChunkingConfigUpdate = (config: any) => {
|
|
|
|
|
|
if (formData.value) {
|
|
|
|
|
|
formData.value.chunkingConfig = { ...config }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleMultimodalUpdate = (config: any) => {
|
|
|
|
|
|
if (formData.value) {
|
|
|
|
|
|
formData.value.multimodalConfig = { ...config }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleNodeExtractUpdate = (config: any) => {
|
|
|
|
|
|
if (formData.value) {
|
2025-11-25 08:51:14 +00:00
|
|
|
|
formData.value.nodeExtractConfig = { ...config }
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证表单
|
|
|
|
|
|
const validateForm = (): boolean => {
|
|
|
|
|
|
if (!formData.value) return false
|
|
|
|
|
|
|
|
|
|
|
|
// 验证基本信息
|
|
|
|
|
|
if (!formData.value.name || !formData.value.name.trim()) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
MessagePlugin.warning(t('knowledgeEditor.messages.nameRequired'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
currentSection.value = 'basic'
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证模型配置 - 必须配置 embedding 和 summary 模型
|
|
|
|
|
|
if (!formData.value.modelConfig.embeddingModelId) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
MessagePlugin.warning(t('knowledgeEditor.messages.embeddingRequired'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
currentSection.value = 'models'
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!formData.value.modelConfig.llmModelId) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
MessagePlugin.warning(t('knowledgeEditor.messages.summaryRequired'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
currentSection.value = 'models'
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证多模态配置(如果启用)
|
|
|
|
|
|
if (formData.value.multimodalConfig.enabled) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
const validation = (advancedSettingsRef.value as any)?.validateMultimodal?.()
|
2025-11-06 13:12:26 +00:00
|
|
|
|
if (validation && !validation.valid) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
MessagePlugin.warning(validation.message || t('knowledgeEditor.messages.multimodalInvalid'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
currentSection.value = 'advanced'
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 17:30:17 +00:00
|
|
|
|
if (formData.value.type === 'faq' && !formData.value.faqConfig?.indexMode) {
|
|
|
|
|
|
MessagePlugin.warning(t('knowledgeEditor.messages.indexModeRequired'))
|
|
|
|
|
|
currentSection.value = 'faq'
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 构建提交数据
|
|
|
|
|
|
const buildSubmitData = () => {
|
|
|
|
|
|
if (!formData.value) return null
|
|
|
|
|
|
|
|
|
|
|
|
const data: any = {
|
|
|
|
|
|
name: formData.value.name,
|
|
|
|
|
|
description: formData.value.description,
|
2025-11-14 17:30:17 +00:00
|
|
|
|
type: formData.value.type,
|
2025-11-06 13:12:26 +00:00
|
|
|
|
chunking_config: {
|
|
|
|
|
|
chunk_size: formData.value.chunkingConfig.chunkSize,
|
|
|
|
|
|
chunk_overlap: formData.value.chunkingConfig.chunkOverlap,
|
|
|
|
|
|
separators: formData.value.chunkingConfig.separators,
|
|
|
|
|
|
enable_multimodal: formData.value.multimodalConfig.enabled
|
|
|
|
|
|
},
|
|
|
|
|
|
embedding_model_id: formData.value.modelConfig.embeddingModelId,
|
|
|
|
|
|
summary_model_id: formData.value.modelConfig.llmModelId
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 添加多模态配置
|
2025-11-20 12:08:24 +00:00
|
|
|
|
data.vlm_config = {
|
|
|
|
|
|
enabled: formData.value.multimodalConfig.enabled,
|
|
|
|
|
|
model_id: formData.value.multimodalConfig.enabled
|
|
|
|
|
|
? (formData.value.multimodalConfig.vllmModelId || '')
|
|
|
|
|
|
: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
if (formData.value.multimodalConfig.enabled) {
|
|
|
|
|
|
const storageType = formData.value.multimodalConfig.storageType
|
|
|
|
|
|
if (storageType === 'minio') {
|
|
|
|
|
|
data.cos_config = {
|
|
|
|
|
|
provider: 'minio',
|
|
|
|
|
|
bucket_name: formData.value.multimodalConfig.minio.bucketName,
|
|
|
|
|
|
use_ssl: formData.value.multimodalConfig.minio.useSSL,
|
|
|
|
|
|
path_prefix: formData.value.multimodalConfig.minio.pathPrefix || undefined
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
data.cos_config = {
|
|
|
|
|
|
provider: 'cos',
|
|
|
|
|
|
secret_id: formData.value.multimodalConfig.cos.secretId,
|
|
|
|
|
|
secret_key: formData.value.multimodalConfig.cos.secretKey,
|
|
|
|
|
|
region: formData.value.multimodalConfig.cos.region,
|
|
|
|
|
|
bucket_name: formData.value.multimodalConfig.cos.bucketName,
|
|
|
|
|
|
app_id: formData.value.multimodalConfig.cos.appId,
|
|
|
|
|
|
path_prefix: formData.value.multimodalConfig.cos.pathPrefix || undefined
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 添加知识图谱配置
|
2025-11-25 08:51:14 +00:00
|
|
|
|
if (formData.value.nodeExtractConfig.enabled) {
|
2025-11-06 13:12:26 +00:00
|
|
|
|
data.extract_config = {
|
|
|
|
|
|
enabled: true,
|
2025-11-25 08:51:14 +00:00
|
|
|
|
text: formData.value.nodeExtractConfig.text,
|
|
|
|
|
|
tags: formData.value.nodeExtractConfig.tags,
|
|
|
|
|
|
nodes: formData.value.nodeExtractConfig.nodes,
|
|
|
|
|
|
relations: formData.value.nodeExtractConfig.relations
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 17:30:17 +00:00
|
|
|
|
if (formData.value.type === 'faq') {
|
|
|
|
|
|
data.faq_config = {
|
2025-11-16 15:35:54 +00:00
|
|
|
|
index_mode: formData.value.faqConfig?.indexMode || 'question_only',
|
|
|
|
|
|
question_index_mode: formData.value.faqConfig?.questionIndexMode || 'separate'
|
2025-11-14 17:30:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
return data
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 提交表单
|
|
|
|
|
|
const handleSubmit = async () => {
|
|
|
|
|
|
if (!validateForm()) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
saving.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const data = buildSubmitData()
|
|
|
|
|
|
if (!data) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
throw new Error(t('knowledgeEditor.messages.buildDataFailed'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (props.mode === 'create') {
|
|
|
|
|
|
// 创建模式:一次性创建知识库及所有配置
|
2025-11-13 11:34:33 +00:00
|
|
|
|
const result: any = await createKnowledgeBase(data)
|
2025-11-06 13:12:26 +00:00
|
|
|
|
if (!result.success || !result.data?.id) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
throw new Error(result.message || t('knowledgeEditor.messages.createFailed'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
2025-11-13 11:34:33 +00:00
|
|
|
|
MessagePlugin.success(t('knowledgeEditor.messages.createSuccess'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
emit('success', result.data.id)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 编辑模式:分别更新基本信息和配置
|
|
|
|
|
|
if (!props.kbId) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
throw new Error(t('knowledgeEditor.messages.missingId'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 17:30:17 +00:00
|
|
|
|
// 1. 更新基本信息(名称、描述)和 FAQ 配置
|
|
|
|
|
|
const updateConfig: any = {}
|
|
|
|
|
|
if (formData.value.type === 'faq' && formData.value.faqConfig) {
|
|
|
|
|
|
updateConfig.faq_config = {
|
2025-11-16 15:35:54 +00:00
|
|
|
|
index_mode: formData.value.faqConfig.indexMode || 'question_only',
|
|
|
|
|
|
question_index_mode: formData.value.faqConfig.questionIndexMode || 'separate'
|
2025-11-14 17:30:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-11-06 13:12:26 +00:00
|
|
|
|
await updateKnowledgeBase(props.kbId, {
|
|
|
|
|
|
name: data.name,
|
|
|
|
|
|
description: data.description,
|
2025-11-14 17:30:17 +00:00
|
|
|
|
config: updateConfig
|
2025-11-06 13:12:26 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 更新完整配置(模型、分块、多模态、知识图谱等)
|
|
|
|
|
|
const config: KBModelConfigRequest = {
|
|
|
|
|
|
llmModelId: data.summary_model_id,
|
|
|
|
|
|
embeddingModelId: data.embedding_model_id,
|
2025-11-20 12:08:24 +00:00
|
|
|
|
vlm_config: data.vlm_config,
|
2025-11-06 13:12:26 +00:00
|
|
|
|
documentSplitting: {
|
|
|
|
|
|
chunkSize: data.chunking_config.chunk_size,
|
|
|
|
|
|
chunkOverlap: data.chunking_config.chunk_overlap,
|
|
|
|
|
|
separators: data.chunking_config.separators
|
|
|
|
|
|
},
|
|
|
|
|
|
multimodal: {
|
2025-11-20 12:08:24 +00:00
|
|
|
|
enabled: !!data.cos_config || !!data.vlm_config?.enabled,
|
2025-11-06 13:12:26 +00:00
|
|
|
|
storageType: data.cos_config?.provider || 'minio',
|
|
|
|
|
|
cos: data.cos_config?.provider === 'cos' ? {
|
|
|
|
|
|
secretId: data.cos_config.secret_id,
|
|
|
|
|
|
secretKey: data.cos_config.secret_key,
|
|
|
|
|
|
region: data.cos_config.region,
|
|
|
|
|
|
bucketName: data.cos_config.bucket_name,
|
|
|
|
|
|
appId: data.cos_config.app_id,
|
|
|
|
|
|
pathPrefix: data.cos_config.path_prefix || ''
|
|
|
|
|
|
} : undefined,
|
|
|
|
|
|
minio: data.cos_config?.provider === 'minio' ? {
|
|
|
|
|
|
bucketName: data.cos_config.bucket_name,
|
|
|
|
|
|
useSSL: data.cos_config.use_ssl || false,
|
|
|
|
|
|
pathPrefix: data.cos_config.path_prefix || ''
|
|
|
|
|
|
} : undefined
|
|
|
|
|
|
},
|
|
|
|
|
|
nodeExtract: {
|
|
|
|
|
|
enabled: data.extract_config?.enabled || false,
|
|
|
|
|
|
text: data.extract_config?.text || '',
|
|
|
|
|
|
tags: data.extract_config?.tags || [],
|
2025-11-25 08:44:44 +00:00
|
|
|
|
nodes: data.extract_config?.nodes || [],
|
|
|
|
|
|
relations: data.extract_config?.relations || []
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await updateKBConfig(props.kbId, config)
|
2025-11-13 11:34:33 +00:00
|
|
|
|
MessagePlugin.success(t('knowledgeEditor.messages.updateSuccess'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
emit('success', props.kbId)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleClose()
|
|
|
|
|
|
} catch (error: any) {
|
2025-11-13 11:34:33 +00:00
|
|
|
|
console.error('Knowledge base operation failed:', error)
|
|
|
|
|
|
MessagePlugin.error(error?.message || t('common.operationFailed'))
|
2025-11-06 13:12:26 +00:00
|
|
|
|
} finally {
|
|
|
|
|
|
saving.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 重置所有状态
|
|
|
|
|
|
const resetState = () => {
|
|
|
|
|
|
currentSection.value = 'basic'
|
|
|
|
|
|
formData.value = null
|
|
|
|
|
|
hasFiles.value = false
|
|
|
|
|
|
saving.value = false
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
|
const handleClose = () => {
|
|
|
|
|
|
emit('update:visible', false)
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
resetState()
|
|
|
|
|
|
}, 300)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 监听弹窗打开/关闭
|
|
|
|
|
|
watch(() => props.visible, async (newVal) => {
|
|
|
|
|
|
if (newVal) {
|
|
|
|
|
|
// 打开弹窗时,先重置状态
|
|
|
|
|
|
resetState()
|
|
|
|
|
|
|
2025-11-07 08:40:53 +00:00
|
|
|
|
// 检查是否有初始 section,如果有则跳转
|
|
|
|
|
|
if (uiStore.kbEditorInitialSection) {
|
|
|
|
|
|
currentSection.value = uiStore.kbEditorInitialSection
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
// 加载模型列表
|
|
|
|
|
|
await loadAllModels()
|
|
|
|
|
|
|
|
|
|
|
|
// 根据模式加载数据
|
|
|
|
|
|
if (props.mode === 'edit' && props.kbId) {
|
|
|
|
|
|
await loadKBData()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 创建模式:初始化空表单
|
2025-11-14 17:30:17 +00:00
|
|
|
|
formData.value = initFormData(props.initialType || 'document')
|
2025-11-06 13:12:26 +00:00
|
|
|
|
hasFiles.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 关闭弹窗时,延迟重置状态(等待动画结束)
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
resetState()
|
2025-11-07 08:40:53 +00:00
|
|
|
|
currentSection.value = 'basic' // 重置为默认 section
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}, 300)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-11-14 04:09:52 +00:00
|
|
|
|
|
|
|
|
|
|
// 监听全局设置弹窗关闭后刷新模型列表
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => uiStore.showSettingsModal,
|
|
|
|
|
|
async (visible, previous) => {
|
|
|
|
|
|
if (!visible && previous && props.visible) {
|
|
|
|
|
|
await loadAllModels()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2025-11-06 13:12:26 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
|
// 复用创建知识库的样式
|
|
|
|
|
|
.settings-overlay {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
|
backdrop-filter: blur(4px);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.settings-modal {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
width: 90vw;
|
|
|
|
|
|
max-width: 1100px;
|
|
|
|
|
|
height: 85vh;
|
|
|
|
|
|
max-height: 750px;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.close-btn {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 20px;
|
|
|
|
|
|
right: 20px;
|
|
|
|
|
|
width: 32px;
|
|
|
|
|
|
height: 32px;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
z-index: 10;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background: #e5e5e5;
|
|
|
|
|
|
color: #000;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.settings-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.settings-sidebar {
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
background: #fafafa;
|
|
|
|
|
|
border-right: 1px solid #e5e5e5;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar-header {
|
|
|
|
|
|
padding: 24px 20px;
|
|
|
|
|
|
border-bottom: 1px solid #e5e5e5;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar-title {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-family: "PingFang SC";
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #000000e6;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.settings-nav {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
padding: 12px 8px;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.nav-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding: 10px 12px;
|
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
font-family: "PingFang SC";
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: #00000099;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background: #f0f0f0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
background: #07c05f1a;
|
|
|
|
|
|
color: #07c05f;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.nav-icon {
|
|
|
|
|
|
margin-right: 8px;
|
2025-11-06 15:13:13 +00:00
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2025-11-06 13:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.nav-label {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.settings-content {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content-wrapper {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
padding: 24px 32px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section {
|
|
|
|
|
|
margin-bottom: 32px;
|
|
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-content {
|
|
|
|
|
|
.section-header {
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-title {
|
|
|
|
|
|
margin: 0 0 8px 0;
|
|
|
|
|
|
font-family: "PingFang SC";
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #000000e6;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-desc {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-family: "PingFang SC";
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: #00000066;
|
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-body {
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.form-item {
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.form-label {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
|
font-family: "PingFang SC";
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: #000000e6;
|
|
|
|
|
|
|
|
|
|
|
|
&.required::after {
|
|
|
|
|
|
content: '*';
|
|
|
|
|
|
color: #FA5151;
|
|
|
|
|
|
margin-left: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 17:30:17 +00:00
|
|
|
|
.form-tip {
|
|
|
|
|
|
margin-top: 6px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #00000066;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.faq-guide {
|
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
color: #00000099;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
line-height: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 13:12:26 +00:00
|
|
|
|
.settings-footer {
|
|
|
|
|
|
padding: 16px 32px;
|
|
|
|
|
|
border-top: 1px solid #e5e5e5;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 过渡动画
|
|
|
|
|
|
.modal-enter-active,
|
|
|
|
|
|
.modal-leave-active {
|
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.modal-enter-from,
|
|
|
|
|
|
.modal-leave-to {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
|
|
|
|
.settings-modal {
|
|
|
|
|
|
transform: scale(0.95);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-11-14 17:30:17 +00:00
|
|
|
|
|
|
|
|
|
|
// Radio-group 样式优化,符合项目主题风格
|
|
|
|
|
|
:deep(.t-radio-group) {
|
|
|
|
|
|
.t-radio-group--filled {
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
}
|
|
|
|
|
|
.t-radio-button {
|
|
|
|
|
|
border-color: #d9d9d9;
|
|
|
|
|
|
// color: #00000099;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover:not(.t-is-disabled) {
|
|
|
|
|
|
border-color: #07c05f;
|
|
|
|
|
|
color: #07c05f;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.t-is-checked {
|
|
|
|
|
|
background: #07c05f;
|
|
|
|
|
|
border-color: #07c05f;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover:not(.t-is-disabled) {
|
|
|
|
|
|
background: #05a04f;
|
|
|
|
|
|
border-color: #05a04f;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 禁用状态样式
|
|
|
|
|
|
&.t-is-disabled {
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
border-color: #d9d9d9;
|
|
|
|
|
|
color: #00000040;
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
|
|
|
|
|
|
|
&.t-is-checked {
|
|
|
|
|
|
background: #f0f0f0;
|
|
|
|
|
|
border-color: #d9d9d9;
|
|
|
|
|
|
color: #00000066;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-11-06 13:12:26 +00:00
|
|
|
|
</style>
|
|
|
|
|
|
|