fix: 修复多路召回前端校验错误
This commit is contained in:
parent
b99df0d27c
commit
4ad2ec5268
@ -62,62 +62,6 @@
|
|||||||
class="custom-slider"
|
class="custom-slider"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
|
||||||
v-if="!isWorkflowType"
|
|
||||||
:label="$t('views.application.applicationForm.dialogues.noReferencesAction')"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
label-position="top"
|
|
||||||
ref="noReferencesformRef"
|
|
||||||
:model="noReferencesform"
|
|
||||||
:rules="noReferencesRules"
|
|
||||||
class="w-full"
|
|
||||||
:hide-required-asterisk="true"
|
|
||||||
>
|
|
||||||
<el-radio-group
|
|
||||||
v-model="form.no_references_setting.status"
|
|
||||||
class="radio-block mb-16"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-radio value="ai_questioning">
|
|
||||||
<p>
|
|
||||||
{{ $t('views.application.applicationForm.dialogues.continueQuestioning') }}
|
|
||||||
</p>
|
|
||||||
<el-form-item
|
|
||||||
v-if="form.no_references_setting.status === 'ai_questioning'"
|
|
||||||
:label="$t('views.application.applicationForm.form.prompt.label')"
|
|
||||||
prop="ai_questioning"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="noReferencesform.ai_questioning"
|
|
||||||
:rows="2"
|
|
||||||
type="textarea"
|
|
||||||
maxlength="2048"
|
|
||||||
:placeholder="defaultValue['ai_questioning']"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-radio>
|
|
||||||
</div>
|
|
||||||
<div class="mt-8">
|
|
||||||
<el-radio value="designated_answer">
|
|
||||||
<p>{{ $t('views.application.applicationForm.dialogues.provideAnswer') }}</p>
|
|
||||||
<el-form-item
|
|
||||||
v-if="form.no_references_setting.status === 'designated_answer'"
|
|
||||||
prop="designated_answer"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="noReferencesform.designated_answer"
|
|
||||||
:rows="2"
|
|
||||||
type="textarea"
|
|
||||||
maxlength="2048"
|
|
||||||
:placeholder="defaultValue['designated_answer']"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-radio>
|
|
||||||
</div>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
@ -127,7 +71,7 @@
|
|||||||
<el-button @click.prevent="dialogVisible = false">{{
|
<el-button @click.prevent="dialogVisible = false">{{
|
||||||
$t('views.application.applicationForm.buttons.cancel')
|
$t('views.application.applicationForm.buttons.cancel')
|
||||||
}}</el-button>
|
}}</el-button>
|
||||||
<el-button type="primary" @click="submit(noReferencesformRef)" :loading="loading">
|
<el-button type="primary" @click="submit()" :loading="loading">
|
||||||
{{ $t('views.application.applicationForm.buttons.save') }}
|
{{ $t('views.application.applicationForm.buttons.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@ -135,15 +79,14 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, reactive } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import { isWorkFlow } from '@/utils/application'
|
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
const paramFormRef = ref()
|
const paramFormRef = ref<FormInstance>()
|
||||||
const noReferencesformRef = ref()
|
|
||||||
|
|
||||||
const defaultValue = {
|
const defaultValue = {
|
||||||
ai_questioning: '{question}',
|
ai_questioning: '{question}',
|
||||||
@ -152,95 +95,36 @@ const defaultValue = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
search_mode: 'embedding',
|
|
||||||
top_n: 3,
|
top_n: 3,
|
||||||
similarity: 0.6,
|
similarity: 0.6,
|
||||||
max_paragraph_char_number: 5000,
|
max_paragraph_char_number: 5000
|
||||||
no_references_setting: {
|
|
||||||
status: 'ai_questioning',
|
|
||||||
value: '{question}'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const noReferencesform = ref<any>({
|
|
||||||
ai_questioning: defaultValue['ai_questioning'],
|
|
||||||
designated_answer: defaultValue['designated_answer']
|
|
||||||
})
|
|
||||||
|
|
||||||
const noReferencesRules = reactive<FormRules<any>>({
|
|
||||||
ai_questioning: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: t('views.application.applicationForm.dialogues.promptPlaceholder'),
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
designated_answer: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: t('views.application.applicationForm.dialogues.concentPlaceholder'),
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
const isWorkflowType = ref(false)
|
|
||||||
|
|
||||||
watch(dialogVisible, (bool) => {
|
watch(dialogVisible, (bool) => {
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
form.value = {
|
form.value = {
|
||||||
search_mode: 'embedding',
|
|
||||||
top_n: 3,
|
top_n: 3,
|
||||||
similarity: 0.6,
|
similarity: 0.6,
|
||||||
max_paragraph_char_number: 5000,
|
max_paragraph_char_number: 5000
|
||||||
no_references_setting: {
|
|
||||||
status: 'ai_questioning',
|
|
||||||
value: ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
noReferencesform.value = {
|
|
||||||
ai_questioning: defaultValue['ai_questioning'],
|
|
||||||
designated_answer: defaultValue['designated_answer']
|
|
||||||
}
|
|
||||||
noReferencesformRef.value?.clearValidate()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const open = (data: any, type?: string) => {
|
const open = (data: any) => {
|
||||||
isWorkflowType.value = isWorkFlow(type)
|
|
||||||
form.value = { ...form.value, ...cloneDeep(data) }
|
form.value = { ...form.value, ...cloneDeep(data) }
|
||||||
noReferencesform.value[form.value.no_references_setting.status] =
|
|
||||||
form.value.no_references_setting.value
|
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit = async (formEl: FormInstance | undefined) => {
|
const submit = () => {
|
||||||
if (isWorkflowType.value) {
|
paramFormRef?.value?.validate((valid: boolean, fields: any) => {
|
||||||
delete form.value['no_references_setting']
|
if (valid) {
|
||||||
emit('refresh', form.value)
|
emit('refresh', cloneDeep(form.value))
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
} else {
|
}
|
||||||
if (!formEl) return
|
})
|
||||||
await formEl.validate((valid, fields) => {
|
|
||||||
if (valid) {
|
|
||||||
form.value.no_references_setting.value =
|
|
||||||
noReferencesform.value[form.value.no_references_setting.status]
|
|
||||||
emit('refresh', form.value)
|
|
||||||
dialogVisible.value = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeHandle(val: string) {
|
|
||||||
if (val === 'keywords') {
|
|
||||||
form.value.similarity = 0
|
|
||||||
} else {
|
|
||||||
form.value.similarity = 0.6
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|||||||
@ -46,7 +46,6 @@
|
|||||||
>
|
>
|
||||||
<NodeCascader
|
<NodeCascader
|
||||||
:key="index"
|
:key="index"
|
||||||
ref="nodeCascaderRef"
|
|
||||||
:nodeModel="nodeModel"
|
:nodeModel="nodeModel"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
placeholder="请选择重排内容"
|
placeholder="请选择重排内容"
|
||||||
@ -233,7 +232,7 @@ const form = {
|
|||||||
const providerOptions = ref<Array<Provider>>([])
|
const providerOptions = ref<Array<Provider>>([])
|
||||||
const modelOptions = ref<any>(null)
|
const modelOptions = ref<any>(null)
|
||||||
const openParamSettingDialog = () => {
|
const openParamSettingDialog = () => {
|
||||||
ParamSettingDialogRef.value?.open(form_data.value, 'WORK_FLOW')
|
ParamSettingDialogRef.value?.open(form_data.value.reranker_setting)
|
||||||
}
|
}
|
||||||
const deleteCondition = (index: number) => {
|
const deleteCondition = (index: number) => {
|
||||||
const list = cloneDeep(props.nodeModel.properties.node_data.reranker_reference_list)
|
const list = cloneDeep(props.nodeModel.properties.node_data.reranker_reference_list)
|
||||||
@ -263,7 +262,7 @@ const form_data = computed({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
function refreshParam(data: any) {
|
function refreshParam(data: any) {
|
||||||
set(props.nodeModel.properties.node_data, 'reranker_setting', data.dataset_setting)
|
set(props.nodeModel.properties.node_data, 'reranker_setting', data)
|
||||||
}
|
}
|
||||||
function getModel() {
|
function getModel() {
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user