mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-31 02:02:48 +00:00
feat: 创建应用
This commit is contained in:
parent
e21bd3db25
commit
7b6ebc282e
|
|
@ -12,6 +12,7 @@
|
|||
<div class="scrollbar-height-left">
|
||||
<el-scrollbar>
|
||||
<el-form
|
||||
hide-required-asterisk
|
||||
ref="applicationFormRef"
|
||||
:model="applicationForm"
|
||||
:rules="rules"
|
||||
|
|
@ -20,7 +21,12 @@
|
|||
class="p-24"
|
||||
style="padding-top: 0"
|
||||
>
|
||||
<el-form-item label="应用名称" prop="name">
|
||||
<el-form-item prop="name">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>应用名称 <span class="danger">*</span></span>
|
||||
</div>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="applicationForm.name"
|
||||
maxlength="64"
|
||||
|
|
@ -38,10 +44,17 @@
|
|||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择模型" prop="model_id">
|
||||
<el-form-item prop="model_id">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>AI 模型 <span class="danger">*</span></span>
|
||||
|
||||
<el-button type="primary" link>提示词</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-select
|
||||
v-model="applicationForm.model_id"
|
||||
placeholder="请选择模型"
|
||||
placeholder="请选择 AI 模型"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option-group
|
||||
|
|
@ -86,16 +99,90 @@
|
|||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>关联知识库</span>
|
||||
<el-button type="primary" link @click="openDatasetDialog">
|
||||
<el-icon class="mr-4"><Plus /></el-icon> 添加
|
||||
</el-button>
|
||||
|
||||
<el-popover :visible="popoverVisible" :width="300" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" link @click="popoverVisible = !popoverVisible"
|
||||
>参数设置</el-button
|
||||
>
|
||||
</template>
|
||||
<div class="set-rules__form">
|
||||
<div class="form-item mb-16">
|
||||
<div class="title flex align-center mb-8">
|
||||
<span style="margin-right: 4px">相似度</span>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
content="相似度越高相关性越强。"
|
||||
placement="right"
|
||||
>
|
||||
<el-icon style="font-size: 16px">
|
||||
<Warning />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div @click.stop>
|
||||
高于
|
||||
<el-input-number
|
||||
v-model="formInline.similarity"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:precision="3"
|
||||
:step="0.1"
|
||||
controls-position="right"
|
||||
style="width: 100px"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item mb-16">
|
||||
<div class="title mb-8">引用分段数</div>
|
||||
<div @click.stop>
|
||||
TOP
|
||||
<el-input-number
|
||||
v-model="formInline.top_number"
|
||||
:min="1"
|
||||
:max="10"
|
||||
controls-position="right"
|
||||
style="width: 100px"
|
||||
size="small"
|
||||
/>
|
||||
个分段
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-item mb-16">
|
||||
<div class="title mb-8">最多引用字符数</div>
|
||||
<div class="flex align-center">
|
||||
<el-slider
|
||||
v-model="formInline.top_number"
|
||||
show-input
|
||||
:show-input-controls="false"
|
||||
:min="500"
|
||||
:max="10000"
|
||||
style="width: 220px"
|
||||
size="small"
|
||||
/>
|
||||
<span class="ml-4">个字符</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<el-button @click="popoverVisible = false" size="small">取消</el-button>
|
||||
<el-button type="primary" @click="popoverVisible = false" size="small"
|
||||
>确认</el-button
|
||||
>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="applicationForm.dataset_id_list.length == 0">
|
||||
<el-text type="info">关联的知识库展示在这里</el-text>
|
||||
</div>
|
||||
<div class="w-full" v-else>
|
||||
<div class="w-full">
|
||||
<el-row :gutter="12">
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mb-8">
|
||||
<CardAdd
|
||||
title="关联知识库"
|
||||
@click="openDatasetDialog"
|
||||
style="min-height: 50px; font-size: 14px"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col
|
||||
:xs="24"
|
||||
:sm="24"
|
||||
|
|
@ -230,6 +317,12 @@ const applicationForm = ref<ApplicationFormType>({
|
|||
dataset_id_list: []
|
||||
})
|
||||
|
||||
const formInline = reactive({
|
||||
similarity: 0.6,
|
||||
top_number: 5
|
||||
})
|
||||
const popoverVisible = ref(false)
|
||||
|
||||
const rules = reactive<FormRules<ApplicationFormType>>({
|
||||
name: [{ required: true, message: '请输入应用名称', trigger: 'blur' }],
|
||||
model_id: [
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<template #icon>
|
||||
<AppAvatar :name="index + 1 + ''" class="mr-12 avatar-light" :size="22" />
|
||||
</template>
|
||||
<div class="active-button primary">{{ (item.similarity * 100).toFixed(2) }}%</div>
|
||||
<div class="active-button primary">{{ item.similarity.toFixed(3) }}</div>
|
||||
<template #footer>
|
||||
<div class="footer-content flex-between">
|
||||
<el-text>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
|
||||
</LayoutContainer>
|
||||
<div class="hit-test__operate p-24 pt-0">
|
||||
<el-popover :visible="popoverVisible" placement="top-start" :width="560" trigger="click">
|
||||
<el-popover :visible="popoverVisible" placement="top-start" :width="600" trigger="click">
|
||||
<template #reference>
|
||||
<el-button icon="Setting" class="mb-8" @click="popoverVisible = !popoverVisible"
|
||||
>参数设置</el-button
|
||||
|
|
@ -83,15 +83,16 @@
|
|||
</template>
|
||||
<div class="flex">
|
||||
<div>
|
||||
相似度
|
||||
相似度高于
|
||||
<el-input-number
|
||||
v-model="formInline.similarity"
|
||||
:min="1"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:precision="3"
|
||||
:step="0.1"
|
||||
controls-position="right"
|
||||
style="width: 100px"
|
||||
/>
|
||||
%
|
||||
</div>
|
||||
|
||||
<div class="ml-16">
|
||||
|
|
@ -156,7 +157,7 @@ const paragraphDetail = ref<any[]>([])
|
|||
const title = ref('')
|
||||
const inputValue = ref('')
|
||||
const formInline = reactive({
|
||||
similarity: 60,
|
||||
similarity: 0.600,
|
||||
top_number: 5
|
||||
})
|
||||
const popoverVisible = ref(false)
|
||||
|
|
@ -193,7 +194,7 @@ function sendChatHandle(event: any) {
|
|||
function getHitTestList() {
|
||||
const obj = {
|
||||
query_text: inputValue.value,
|
||||
similarity: formInline.similarity / 100,
|
||||
similarity: formInline.similarity,
|
||||
top_number: formInline.top_number
|
||||
}
|
||||
if (isDataset.value) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue