Merge branch 'main' into storage-allow-list
This commit is contained in:
@@ -149,7 +149,7 @@ interface ConnectorDef {
|
||||
permissionDocUrl: string
|
||||
permissionPageUrl: string
|
||||
requiredPermissions: string[]
|
||||
fields: { key: string; labelKey: string; placeholder: string; secret?: boolean }[]
|
||||
fields: { key: string; labelKey: string; placeholder: string; secret?: boolean; optional?: boolean; hintKey?: string }[]
|
||||
}
|
||||
|
||||
const connectorDefs = computed<ConnectorDef[]>(() => [
|
||||
@@ -183,13 +183,17 @@ const connectorDefs = computed<ConnectorDef[]>(() => [
|
||||
},
|
||||
{
|
||||
type: 'yuque',
|
||||
available: false,
|
||||
docUrl: 'https://www.yuque.com/settings/tokens',
|
||||
permissionDocUrl: '',
|
||||
permissionPageUrl: '',
|
||||
requiredPermissions: [],
|
||||
available: true,
|
||||
docUrl: 'https://www.yuque.com/yuque/developer/api',
|
||||
permissionDocUrl: 'https://www.yuque.com/yuque/developer/api',
|
||||
permissionPageUrl: 'https://www.yuque.com/settings/tokens',
|
||||
requiredPermissions: [
|
||||
'repo:read',
|
||||
'doc:read',
|
||||
],
|
||||
fields: [
|
||||
{ key: 'api_token', labelKey: 'datasource.field.apiToken', placeholder: '', secret: true },
|
||||
{ key: 'base_url', labelKey: 'datasource.field.baseUrl', placeholder: 'https://www.yuque.com', optional: true, hintKey: 'datasource.field.baseUrlHint' },
|
||||
],
|
||||
},
|
||||
])
|
||||
@@ -244,6 +248,7 @@ function selectType(def: ConnectorDef) {
|
||||
async function testConnection() {
|
||||
const fields = currentDef.value?.fields || []
|
||||
for (const f of fields) {
|
||||
if (f.optional) continue
|
||||
if (!form.value.config.credentials[f.key]) {
|
||||
MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`)
|
||||
return
|
||||
@@ -373,6 +378,7 @@ function toggleResource(id: string) {
|
||||
function validateStep1Fields(): boolean {
|
||||
const fields = currentDef.value?.fields || []
|
||||
for (const f of fields) {
|
||||
if (f.optional) continue
|
||||
if (!form.value.config.credentials[f.key]) {
|
||||
MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`)
|
||||
return false
|
||||
@@ -458,6 +464,7 @@ async function handleClose() {
|
||||
const resourceTypeLabelMap: Record<string, string> = {
|
||||
wiki_space: 'datasource.resourceType.wikiSpace',
|
||||
doc_category: 'datasource.resourceType.docCategory',
|
||||
book: 'datasource.resourceType.book',
|
||||
}
|
||||
|
||||
function resourceTypeLabel(type: string): string {
|
||||
@@ -549,7 +556,7 @@ const stepTitles = computed(() => [
|
||||
</div>
|
||||
</div>
|
||||
<a :href="currentDef.permissionPageUrl" target="_blank" rel="noopener" class="ds-prereq-link">
|
||||
{{ t('datasource.prereqOpenConsole') }}
|
||||
{{ t(`datasource.prereqOpenConsole_${form.type}`, t('datasource.prereqOpenConsole')) }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -565,12 +572,16 @@ const stepTitles = computed(() => [
|
||||
</div>
|
||||
|
||||
<div v-for="field in currentDef?.fields || []" :key="field.key" class="form-item">
|
||||
<label class="form-label">{{ t(field.labelKey) }}</label>
|
||||
<label class="form-label">
|
||||
{{ t(field.labelKey) }}
|
||||
<span v-if="!field.optional" class="required-mark">*</span>
|
||||
</label>
|
||||
<t-input
|
||||
v-model="form.config.credentials[field.key]"
|
||||
:placeholder="field.placeholder"
|
||||
:type="field.secret ? 'password' : 'text'"
|
||||
/>
|
||||
<div v-if="field.hintKey" class="form-hint">{{ t(field.hintKey) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
@@ -871,7 +882,9 @@ const stepTitles = computed(() => [
|
||||
|
||||
.form-item { margin-bottom: 16px; }
|
||||
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--td-text-color-primary); }
|
||||
.required-mark { color: var(--td-error-color); margin-left: 2px; }
|
||||
.form-tip { font-size: 12px; color: var(--td-text-color-placeholder); margin: 4px 0 12px; }
|
||||
.form-hint { font-size: 12px; color: var(--td-text-color-placeholder); margin-top: 6px; line-height: 1.5; }
|
||||
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
|
||||
.test-ok { color: var(--td-success-color); font-size: 13px; display: flex; align-items: center; gap: 4px; }
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
</div>
|
||||
|
||||
<div class="settings-group">
|
||||
<!-- Question Generation feature -->
|
||||
<!-- Question Generation feature (only useful for RAG indexing) -->
|
||||
<template v-if="ragEnabled !== false">
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('knowledgeEditor.advanced.questionGeneration.label') }}</label>
|
||||
@@ -41,6 +42,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,6 +58,7 @@ interface QuestionGenerationConfig {
|
||||
|
||||
interface Props {
|
||||
questionGeneration?: QuestionGenerationConfig
|
||||
ragEnabled?: boolean
|
||||
allModels?: any[]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div class="kb-multimodal-settings">
|
||||
<div class="section-header">
|
||||
<h2>{{ $t('knowledgeEditor.indexing.title') }}</h2>
|
||||
<p class="section-description">{{ $t('knowledgeEditor.indexing.description') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="settings-group">
|
||||
<!-- Hybrid Search (vector + keyword combined) -->
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('knowledgeEditor.indexing.searchTitle') }}</label>
|
||||
<p class="desc">{{ $t('knowledgeEditor.indexing.searchDesc') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-switch
|
||||
:model-value="searchEnabled"
|
||||
@change="handleSearchToggle"
|
||||
size="medium"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Wiki -->
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('knowledgeEditor.indexing.wikiTitle') }}</label>
|
||||
<p class="desc">{{ $t('knowledgeEditor.indexing.wikiDesc') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-switch
|
||||
:model-value="modelValue.wikiEnabled"
|
||||
@change="(val: boolean) => update('wikiEnabled', val)"
|
||||
size="medium"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Wiki sub-settings (inline when enabled) -->
|
||||
<template v-if="modelValue.wikiEnabled">
|
||||
<slot name="wiki-settings" />
|
||||
</template>
|
||||
|
||||
<!-- Knowledge Graph -->
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('knowledgeEditor.indexing.graphTitle') }}</label>
|
||||
<p class="desc">{{ $t('knowledgeEditor.indexing.graphDesc') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-switch
|
||||
:model-value="modelValue.graphEnabled"
|
||||
@change="(val: boolean) => update('graphEnabled', val)"
|
||||
size="medium"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Graph sub-settings (inline when enabled) -->
|
||||
<template v-if="modelValue.graphEnabled">
|
||||
<slot name="graph-settings" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
export interface IndexingStrategy {
|
||||
vectorEnabled: boolean
|
||||
keywordEnabled: boolean
|
||||
wikiEnabled: boolean
|
||||
graphEnabled: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: IndexingStrategy
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: IndexingStrategy): void
|
||||
}>()
|
||||
|
||||
// Search = vector + keyword combined (the system always uses hybrid search internally)
|
||||
const searchEnabled = computed(() => props.modelValue.vectorEnabled || props.modelValue.keywordEnabled)
|
||||
|
||||
const handleSearchToggle = (val: boolean) => {
|
||||
emit('update:modelValue', {
|
||||
...props.modelValue,
|
||||
vectorEnabled: val,
|
||||
keywordEnabled: val,
|
||||
})
|
||||
}
|
||||
|
||||
const update = (field: keyof IndexingStrategy, value: boolean) => {
|
||||
emit('update:modelValue', {
|
||||
...props.modelValue,
|
||||
[field]: value,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/* NOT scoped — these classes must match the parent modal's scoped styles.
|
||||
Since slot content is rendered in the parent scope, only the wrapper
|
||||
elements defined HERE need their own styles. We replicate the same
|
||||
design tokens used by .kb-multimodal-settings in the parent. */
|
||||
</style>
|
||||
@@ -25,15 +25,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Embedding 嵌入模型 -->
|
||||
<div class="setting-row">
|
||||
<!-- Embedding 嵌入模型 (仅 RAG 检索启用时必填) -->
|
||||
<div v-if="ragEnabled !== false" class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('knowledgeEditor.models.embeddingLabel') }} <span class="required">*</span></label>
|
||||
<label>{{ $t('knowledgeEditor.models.embeddingLabel') }} <span v-if="ragEnabled" class="required">*</span></label>
|
||||
<p class="desc">{{ $t('knowledgeEditor.models.embeddingDesc') }}</p>
|
||||
<t-alert
|
||||
v-if="hasFiles"
|
||||
theme="warning"
|
||||
:message="$t('knowledgeEditor.models.embeddingLocked')"
|
||||
<t-alert
|
||||
v-if="hasFiles"
|
||||
theme="warning"
|
||||
:message="$t('knowledgeEditor.models.embeddingLocked')"
|
||||
style="margin-top: 8px;"
|
||||
/>
|
||||
</div>
|
||||
@@ -51,6 +51,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Wiki 合成模型 (仅当 Wiki 启用时显示) -->
|
||||
<div v-if="wikiEnabled" class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('knowledgeEditor.wiki.synthesisModelLabel') }}</label>
|
||||
<p class="desc">{{ $t('knowledgeEditor.wiki.synthesisModelTip') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<ModelSelector
|
||||
model-type="KnowledgeQA"
|
||||
:selected-model-id="config.wikiSynthesisModelId"
|
||||
:all-models="allModels"
|
||||
@update:selected-model-id="handleWikiModelChange"
|
||||
@add-model="handleAddModel('knowledgeqa')"
|
||||
:placeholder="$t('knowledgeEditor.wiki.synthesisModelPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -65,11 +83,14 @@ interface ModelConfig {
|
||||
llmModelId?: string
|
||||
embeddingModelId?: string
|
||||
vllmModelId?: string
|
||||
wikiSynthesisModelId?: string
|
||||
}
|
||||
|
||||
interface Props {
|
||||
config: ModelConfig
|
||||
hasFiles: boolean
|
||||
wikiEnabled?: boolean
|
||||
ragEnabled?: boolean
|
||||
allModels?: any[]
|
||||
}
|
||||
|
||||
@@ -82,11 +103,9 @@ const emit = defineEmits<{
|
||||
const uiStore = useUIStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
// 引用各个模型选择器
|
||||
const llmSelectorRef = ref<InstanceType<typeof ModelSelector>>()
|
||||
const embeddingSelectorRef = ref<InstanceType<typeof ModelSelector>>()
|
||||
|
||||
// 处理LLM模型变化
|
||||
const handleLLMChange = (modelId: string) => {
|
||||
emit('update:config', {
|
||||
...props.config,
|
||||
@@ -94,7 +113,6 @@ const handleLLMChange = (modelId: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 处理Embedding模型变化
|
||||
const handleEmbeddingChange = (modelId: string) => {
|
||||
emit('update:config', {
|
||||
...props.config,
|
||||
@@ -102,13 +120,16 @@ const handleEmbeddingChange = (modelId: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 处理添加模型按钮点击
|
||||
const handleAddModel = (subSection: string) => {
|
||||
// 打开全局设置对话框,并导航到对应的模型子页面
|
||||
uiStore.openSettings('models', subSection)
|
||||
const handleWikiModelChange = (modelId: string) => {
|
||||
emit('update:config', {
|
||||
...props.config,
|
||||
wikiSynthesisModelId: modelId
|
||||
})
|
||||
}
|
||||
|
||||
// 由于使用了 allModels prop,不再需要单独刷新各个选择器
|
||||
const handleAddModel = (subSection: string) => {
|
||||
uiStore.openSettings('models', subSection)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user