fix: 修复自定义上传参数错误

This commit is contained in:
wenjinbo 2025-09-22 17:25:47 +08:00
parent a4c492b2de
commit 10689d81e3
2 changed files with 29 additions and 20 deletions

View File

@ -104,13 +104,15 @@
<el-form :model="uploadForm.docAnalysisStrategy" label-width="140px" class="config-form"> <el-form :model="uploadForm.docAnalysisStrategy" label-width="140px" class="config-form">
<div class="form-section"> <div class="form-section">
<h4 class="section-title">基础设置</h4> <h4 class="section-title">基础设置</h4>
<!--
<el-form-item label="策略名称"> <el-form-item label="策略名称">
<el-input v-model="uploadForm.docAnalysisStrategy.name" placeholder="请输入策略名称(可选)" /> <el-input v-model="uploadForm.docAnalysisStrategy.name" placeholder="请输入策略名称(可选)" />
</el-form-item> </el-form-item>
-->
<el-form-item label="分段模式"> <el-form-item label="分段模式">
<el-select v-model="uploadForm.docAnalysisStrategy.segmentationMode" placeholder="选择分段模式"> <el-select v-model="uploadForm.docAnalysisStrategy.segmentationMode" placeholder="选择分段模式">
<el-option label="普通分段" value="normal" /> <el-option label="普通分段" value="custom" />
<el-option label="父子分段" value="parent_child" /> <el-option label="父子分段" value="hierarchical" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="uploadForm.docAnalysisStrategy.segmentationMode === 'parent_child'" label="父分段召回模式"> <el-form-item v-if="uploadForm.docAnalysisStrategy.segmentationMode === 'parent_child'" label="父分段召回模式">
@ -128,7 +130,7 @@
</div> </div>
<!-- 普通分段参数 --> <!-- 普通分段参数 -->
<div v-if="uploadForm.docAnalysisStrategy.segmentationMode === 'normal'" class="form-section"> <div v-if="uploadForm.docAnalysisStrategy.segmentationMode === 'custom'" class="form-section">
<h4 class="section-title">分段参数</h4> <h4 class="section-title">分段参数</h4>
<el-form-item label="段分隔符"> <el-form-item label="段分隔符">
<el-input v-model="uploadForm.docAnalysisStrategy.segmentSeparator" placeholder="###" /> <el-input v-model="uploadForm.docAnalysisStrategy.segmentSeparator" placeholder="###" />
@ -152,7 +154,7 @@
</div> </div>
<!-- 父子分段参数 --> <!-- 父子分段参数 -->
<div v-if="uploadForm.docAnalysisStrategy.segmentationMode === 'parent_child'" class="form-section"> <div v-if="uploadForm.docAnalysisStrategy.segmentationMode === 'hierarchical'" class="form-section">
<!-- 父分段设置 (仅在段落召回模式下显示) --> <!-- 父分段设置 (仅在段落召回模式下显示) -->
<div v-if="uploadForm.docAnalysisStrategy.parentSegmentMode === 'paragraph'"> <div v-if="uploadForm.docAnalysisStrategy.parentSegmentMode === 'paragraph'">
<h4 class="section-title">父分段设置</h4> <h4 class="section-title">父分段设置</h4>
@ -204,9 +206,9 @@
<h4 class="section-title">检索设置</h4> <h4 class="section-title">检索设置</h4>
<el-form-item label="搜索方法"> <el-form-item label="搜索方法">
<el-select v-model="uploadForm.docAnalysisStrategy.searchMethod" placeholder="选择搜索方法"> <el-select v-model="uploadForm.docAnalysisStrategy.searchMethod" placeholder="选择搜索方法">
<el-option label="向量搜索" value="vector" /> <el-option label="语义搜索" value="semantic_search" />
<el-option label="全文搜索" value="fulltext" /> <el-option label="全文搜索" value="full_text_search" />
<el-option label="混合搜索" value="hybrid" /> <el-option label="混合搜索" value="hybrid_search" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="Top K"> <el-form-item label="Top K">
@ -246,12 +248,6 @@
inactive-text="关闭" inactive-text="关闭"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="uploadForm.docAnalysisStrategy.rerankingEnable" label="重排序提供商">
<el-input v-model="uploadForm.docAnalysisStrategy.rerankingProviderName" placeholder="提供商名称" />
</el-form-item>
<el-form-item v-if="uploadForm.docAnalysisStrategy.rerankingEnable" label="重排序模型">
<el-input v-model="uploadForm.docAnalysisStrategy.rerankingModelName" placeholder="模型名称" />
</el-form-item>
</div> </div>
</el-form> </el-form>
</div> </div>
@ -329,7 +325,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, nextTick } from 'vue' import { ref, reactive, computed, nextTick, watch } from 'vue'
import { ElMessage, ElNotification, ElLoading } from 'element-plus' import { ElMessage, ElNotification, ElLoading } from 'element-plus'
import type { UploadFile as ElUploadFile } from 'element-plus' import type { UploadFile as ElUploadFile } from 'element-plus'
import { import {
@ -404,7 +400,7 @@ const uploadForm = reactive({
analysisStrategyType: 'adaption', analysisStrategyType: 'adaption',
docAnalysisStrategy: { docAnalysisStrategy: {
name: '', name: '',
segmentationMode: 'normal', segmentationMode: 'custom',
indexingTechnique: 'high_quality', indexingTechnique: 'high_quality',
docForm: 'text_model', docForm: 'text_model',
parentSegmentMode: 'paragraph', parentSegmentMode: 'paragraph',
@ -414,10 +410,10 @@ const uploadForm = reactive({
childSegmentSeparator: '\n\n', childSegmentSeparator: '\n\n',
childMaxLength: 200, childMaxLength: 200,
childOverlapLength: 20, childOverlapLength: 20,
searchMethod: 'hybrid', searchMethod: 'hybrid_search',
rerankingEnable: false, rerankingEnable: false,
rerankingProviderName: '', rerankingProviderName: 'langgenius/huggingface_tei/huggingface_tei',
rerankingModelName: '', rerankingModelName: 'bge-reanker-v2-m3',
topK: 3, topK: 3,
scoreThresholdEnabled: false, scoreThresholdEnabled: false,
scoreThreshold: 0.5, scoreThreshold: 0.5,
@ -433,6 +429,15 @@ const processingTasks = ref([
{ name: '索引构建', progress: 0, status: '等待中' } { name: '索引构建', progress: 0, status: '等待中' }
]) ])
// docForm
watch(() => uploadForm.docAnalysisStrategy.segmentationMode, (newMode) => {
if (newMode === 'custom') {
uploadForm.docAnalysisStrategy.docForm = 'text_model'
} else if (newMode === 'hierarchical') {
uploadForm.docAnalysisStrategy.docForm = 'hierarchical_model'
}
})
// //
const getStep3Title = () => { const getStep3Title = () => {
switch (uploadForm.analysisStrategyType) { switch (uploadForm.analysisStrategyType) {
@ -641,9 +646,9 @@ const handleUpload = async () => {
if (uploadForm.analysisStrategyType === 'custom') { if (uploadForm.analysisStrategyType === 'custom') {
requestData.docAnalysisStrategy = { requestData.docAnalysisStrategy = {
name: uploadForm.docAnalysisStrategy.name || '自定义策略', name: uploadForm.docAnalysisStrategy.name || '自定义策略',
segmentationMode: 'custom', segmentationMode: uploadForm.docAnalysisStrategy.segmentationMode,
indexingTechnique: uploadForm.docAnalysisStrategy.indexingTechnique, indexingTechnique: uploadForm.docAnalysisStrategy.indexingTechnique,
docForm: 'text_model', docForm: uploadForm.docAnalysisStrategy.docForm,
parentSegmentMode: uploadForm.docAnalysisStrategy.parentSegmentMode, parentSegmentMode: uploadForm.docAnalysisStrategy.parentSegmentMode,
segmentSeparator: uploadForm.docAnalysisStrategy.segmentSeparator, segmentSeparator: uploadForm.docAnalysisStrategy.segmentSeparator,
maxLength: uploadForm.docAnalysisStrategy.maxLength, maxLength: uploadForm.docAnalysisStrategy.maxLength,

View File

@ -81,3 +81,7 @@ elasticsearch:
#是否删除索引,重新构建索引 #是否删除索引,重新构建索引
deleteIndex: ${es-deleteIndex:false} deleteIndex: ${es-deleteIndex:false}
voice2text:
url: ${voice2text-url:http://192.168.8.253:11023/v1/audio/transcriptions}
model: ${voice2text-model:whisper-1}