fix: 知识库的检索设置里面没有设计需要向量模型匹配才能使用

This commit is contained in:
Wenjie Zhang 2024-09-13 21:05:46 +08:00
parent 0f249759a7
commit 9f191e739e

View File

@ -61,6 +61,7 @@
<a-tab-pane key="add"> <a-tab-pane key="add">
<template #tab><span><CloudUploadOutlined />添加文件</span></template> <template #tab><span><CloudUploadOutlined />添加文件</span></template>
<div class="db-info-container"> <div class="db-info-container">
<a-alert v-if="database.embed_model != configStore.config.embed_model" message="向量模型不匹配,请重新选择" type="warning" />
<!-- <h3>向知识库中添加文件</h3> --> <!-- <h3>向知识库中添加文件</h3> -->
<div class="upload"> <div class="upload">
<a-upload-dragger <a-upload-dragger
@ -79,16 +80,18 @@
</p> </p>
</a-upload-dragger> </a-upload-dragger>
</div> </div>
<a-button <div class="actions">
type="primary" <a-button
@click="addDocumentByFile" type="primary"
:loading="state.loading" @click="addDocumentByFile"
:disabled="fileList.length === 0" :loading="state.loading"
style="margin: 0px 20px 20px 0;" :disabled="fileList.length === 0"
> style="margin: 0px 20px 20px 0;"
添加到知识库 >
</a-button> 添加到知识库
<a-button @click="handleRefresh" :loading="state.refrashing">刷新状态</a-button> </a-button>
<a-button @click="handleRefresh" :loading="state.refrashing">刷新状态</a-button>
</div>
<a-table :columns="columns" :data-source="database.files" row-key="filename" class="my-table"> <a-table :columns="columns" :data-source="database.files" row-key="filename" class="my-table">
<template #bodyCell="{ column, text, record }"> <template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'filename'"> <template v-if="column.key === 'filename'">
@ -136,6 +139,7 @@
<a-tab-pane key="query-test" force-render> <a-tab-pane key="query-test" force-render>
<template #tab><span><SearchOutlined />检索测试</span></template> <template #tab><span><SearchOutlined />检索测试</span></template>
<div class="db-info-container"> <div class="db-info-container">
<a-alert v-if="database.embed_model != configStore.config.embed_model" message="向量模型不匹配,请重新选择" type="warning" />
<!-- <h3>检索测试</h3> --> <!-- <h3>检索测试</h3> -->
<div class="query-action"> <div class="query-action">
<a-textarea <a-textarea
@ -254,6 +258,11 @@ const filterQueryResults = () => {
} }
const onQuery = () => { const onQuery = () => {
if (database.value.embed_model != configStore.config.embed_model) {
message.error('向量模型不匹配,请重新选择')
return
}
console.log(queryText.value) console.log(queryText.value)
state.searchLoading = true state.searchLoading = true
if (!queryText.value.trim()) { if (!queryText.value.trim()) {
@ -614,6 +623,9 @@ onMounted(() => {
.db-info-container { .db-info-container {
flex: 1 1 auto; flex: 1 1 auto;
display: flex;
flex-direction: column;
gap: 12px;
.query-action { .query-action {
display: flex; display: flex;
@ -714,8 +726,6 @@ onMounted(() => {
} }
.upload { .upload {
margin-bottom: 20px;
.upload-dragger { .upload-dragger {
margin: 0px; margin: 0px;
} }