-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathParamSettingDialog.vue
More file actions
146 lines (138 loc) · 4.09 KB
/
ParamSettingDialog.vue
File metadata and controls
146 lines (138 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
<el-dialog
align-center
:title="$t('common.paramSetting')"
class="param-dialog"
v-model="dialogVisible"
style="width: 550px"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<div>
<el-scrollbar always>
<div class="p-16">
<el-form label-position="top" ref="paramFormRef" :model="form">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item>
<template #label>
<div class="flex align-center">
<span class="mr-4"
>Score {{ $t('views.applicationWorkflow.nodes.rerankerNode.higher') }}</span
>
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.nodes.rerankerNode.ScoreTooltip')"
placement="right"
>
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
</el-tooltip>
</div>
</template>
<el-input-number
v-model="form.similarity"
:min="0"
:max="form.search_mode === 'blend' ? 2 : 1"
:precision="3"
:step="0.1"
:value-on-clear="0"
controls-position="right"
class="w-full"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="$t('views.application.applicationForm.dialog.topReferences')"
>
<el-input-number
v-model="form.top_n"
:min="1"
:max="10000"
:value-on-clear="1"
controls-position="right"
class="w-full"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="$t('views.application.applicationForm.dialog.maxCharacters')">
<el-slider
v-model="form.max_paragraph_char_number"
show-input
:show-input-controls="false"
:min="500"
:max="100000"
class="custom-slider"
/>
</el-form-item>
</el-form>
</div>
</el-scrollbar>
</div>
<template #footer>
<span class="dialog-footer p-16">
<el-button @click.prevent="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="submit()" :loading="loading">
{{ $t('common.save') }}
</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { cloneDeep } from 'lodash'
import type { FormInstance, FormRules } from 'element-plus'
const emit = defineEmits(['refresh'])
const paramFormRef = ref<FormInstance>()
const form = ref<any>({
top_n: 3,
similarity: 0,
max_paragraph_char_number: 5000
})
const dialogVisible = ref<boolean>(false)
const loading = ref(false)
watch(dialogVisible, (bool) => {
if (!bool) {
form.value = {
top_n: 3,
similarity: 0,
max_paragraph_char_number: 5000
}
}
})
const open = (data: any) => {
form.value = { ...form.value, ...cloneDeep(data) }
dialogVisible.value = true
}
const submit = () => {
paramFormRef?.value?.validate((valid: boolean, fields: any) => {
if (valid) {
emit('refresh', cloneDeep(form.value))
dialogVisible.value = false
}
})
}
defineExpose({ open })
</script>
<style lang="scss" scope>
.param-dialog {
padding: 8px 8px 24px 8px;
.el-dialog__header {
padding: 16px 16px 0 16px;
}
.el-dialog__body {
padding: 0 !important;
}
.dialog-max-height {
height: 550px;
}
.custom-slider {
.el-input-number.is-without-controls .el-input__wrapper {
padding: 0 !important;
}
}
}
</style>