feat: 关联知识库增加校验向量模型
This commit is contained in:
parent
73937746f9
commit
5bbb65e4c4
@ -18,7 +18,8 @@
|
|||||||
</slot>
|
</slot>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
<el-checkbox v-bind:modelValue="modelValue.includes(toModelValue)"> </el-checkbox>
|
<el-checkbox v-bind:modelValue="modelValue.includes(toModelValue)" @change="checkboxChange">
|
||||||
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
@ -40,7 +41,7 @@ const toModelValue = computed(() => (props.valueField ? props.data[props.valueFi
|
|||||||
// set: (val) => val
|
// set: (val) => val
|
||||||
// })
|
// })
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue', 'change'])
|
||||||
|
|
||||||
const checked = () => {
|
const checked = () => {
|
||||||
const value = props.modelValue ? props.modelValue : []
|
const value = props.modelValue ? props.modelValue : []
|
||||||
@ -53,6 +54,10 @@ const checked = () => {
|
|||||||
emit('update:modelValue', [...value, toModelValue.value])
|
emit('update:modelValue', [...value, toModelValue.value])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkboxChange() {
|
||||||
|
emit('change')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.card-checkbox {
|
.card-checkbox {
|
||||||
|
|||||||
@ -4,21 +4,28 @@
|
|||||||
v-model="dialogVisible"
|
v-model="dialogVisible"
|
||||||
width="600"
|
width="600"
|
||||||
append-to-body
|
append-to-body
|
||||||
|
class="addDataset-dialog"
|
||||||
>
|
>
|
||||||
<template #header="{ titleId, titleClass }">
|
<template #header="{ titleId, titleClass }">
|
||||||
<div class="my-header flex">
|
<div class="flex-between mb-8">
|
||||||
<h4 :id="titleId" :class="titleClass">
|
<h4 :id="titleId" :class="titleClass">
|
||||||
{{ $t('views.application.applicationForm.dialogues.addDataset') }}
|
{{ $t('views.application.applicationForm.dialogues.addDataset') }}
|
||||||
</h4>
|
</h4>
|
||||||
<el-button link class="ml-16" @click="refresh">
|
<div class="flex align-center">
|
||||||
<el-icon class="mr-4"><Refresh /></el-icon
|
<el-button link class="ml-16" @click="refresh">
|
||||||
>{{ $t('views.application.applicationForm.dialogues.refresh') }}
|
<el-icon class="mr-4"><Refresh /></el-icon
|
||||||
</el-button>
|
>{{ $t('views.application.applicationForm.dialogues.refresh') }}
|
||||||
|
</el-button>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<el-text type="info" class="color-secondary">
|
||||||
|
所选知识库必须使用相同的 Embedding 模型
|
||||||
|
</el-text>
|
||||||
</template>
|
</template>
|
||||||
<el-row :gutter="12" v-loading="loading">
|
<el-row :gutter="12" v-loading="loading">
|
||||||
<el-col :span="12" v-for="(item, index) in data" :key="index" class="mb-16">
|
<el-col :span="12" v-for="(item, index) in filterData" :key="index" class="mb-16">
|
||||||
<CardCheckbox value-field="id" :data="item" v-model="checkList">
|
<CardCheckbox value-field="id" :data="item" v-model="checkList" @change="changeHandle">
|
||||||
<span class="ellipsis">
|
<span class="ellipsis">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</span>
|
</span>
|
||||||
@ -26,19 +33,29 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<div class="flex-between">
|
||||||
<el-button @click.prevent="dialogVisible = false">
|
<div>
|
||||||
{{ $t('views.application.applicationForm.buttons.cancel') }}
|
<el-text type="info" class="color-secondary" v-if="checkList.length > 0">
|
||||||
</el-button>
|
已选 {{ checkList.length }} 个知识库
|
||||||
<el-button type="primary" @click="submitHandle">
|
</el-text>
|
||||||
{{ $t('views.application.applicationForm.buttons.confirm') }}
|
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">
|
||||||
</el-button>
|
清空
|
||||||
</span>
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<span>
|
||||||
|
<el-button @click.prevent="dialogVisible = false">
|
||||||
|
{{ $t('views.application.applicationForm.buttons.cancel') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="submitHandle">
|
||||||
|
{{ $t('views.application.applicationForm.buttons.confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Array<any>,
|
type: Array<any>,
|
||||||
@ -51,6 +68,13 @@ const emit = defineEmits(['addData', 'refresh'])
|
|||||||
|
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
const checkList = ref([])
|
const checkList = ref([])
|
||||||
|
const currentEmbedding = ref('')
|
||||||
|
|
||||||
|
const filterData = computed(() => {
|
||||||
|
return currentEmbedding.value
|
||||||
|
? props.data.filter((v) => v.embedding_mode_id === currentEmbedding.value)
|
||||||
|
: props.data
|
||||||
|
})
|
||||||
|
|
||||||
watch(dialogVisible, (bool) => {
|
watch(dialogVisible, (bool) => {
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
@ -58,6 +82,18 @@ watch(dialogVisible, (bool) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function changeHandle() {
|
||||||
|
if (checkList.value.length === 1) {
|
||||||
|
currentEmbedding.value = props.data.filter(
|
||||||
|
(v) => v.id === checkList.value[0]
|
||||||
|
)[0].embedding_mode_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function clearCheck() {
|
||||||
|
checkList.value = []
|
||||||
|
currentEmbedding.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
const open = (checked: any) => {
|
const open = (checked: any) => {
|
||||||
checkList.value = checked
|
checkList.value = checked
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
@ -73,4 +109,13 @@ const refresh = () => {
|
|||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scope></style>
|
<style lang="scss" scope>
|
||||||
|
.addDataset-dialog {
|
||||||
|
.el-dialog__header.show-close {
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
.el-dialog__headerbtn {
|
||||||
|
top: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -141,4 +141,13 @@ const submit = async (formEl: FormInstance) => {
|
|||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scope></style>
|
<style lang="scss" scope>
|
||||||
|
.edit-mark-dialog {
|
||||||
|
.el-dialog__header.show-close {
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
.el-dialog__headerbtn {
|
||||||
|
top: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user