fix: ts类型错误
This commit is contained in:
parent
78a9697f50
commit
edf46204a8
@ -102,7 +102,7 @@ const postSplitDocument: (data: any) => Promise<Result<any>> = (data) => {
|
||||
* @param loading 加载器
|
||||
* @returns 分段标识列表
|
||||
*/
|
||||
const listSplitPattern: (loading?: Ref<boolean>) => Promise<Result<KeyValue<string, string>>> = (
|
||||
const listSplitPattern: (loading?: Ref<boolean>) => Promise<Result<Array<KeyValue<string, string>>>> = (
|
||||
loading
|
||||
) => {
|
||||
return get(`${prefix}/document/split_pattern`, {}, loading)
|
||||
|
||||
@ -13,43 +13,29 @@
|
||||
</el-radio>
|
||||
<el-radio label="2" size="large" border class="mb-16">
|
||||
<p>高级分段</p>
|
||||
<el-text type="info"
|
||||
>用户可根据文档规范自行设置分段标识符、分段长度以及清洗规则
|
||||
<el-text type="info">用户可根据文档规范自行设置分段标识符、分段长度以及清洗规则
|
||||
</el-text>
|
||||
<el-card shadow="never" class="card-never mt-16" v-if="radio === '2'">
|
||||
<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 effect="dark" content="按照所选符号先后顺序做递归分割,分割结果超出分段长度将截取至分段长度。" placement="right">
|
||||
<el-icon style="font-size: 16px">
|
||||
<Warning />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<el-select v-loading="patternLoading" v-model="form.patterns" multiple placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in splitPatternList"
|
||||
:key="item"
|
||||
:label="item.key"
|
||||
:value="item.value"
|
||||
multiple
|
||||
>
|
||||
<el-option v-for="item in splitPatternList" :key="item" :label="item.key" :value="item.value"
|
||||
multiple>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="form-item mb-16">
|
||||
<div class="title mb-8">分段长度</div>
|
||||
<el-slider
|
||||
v-model="form.limit"
|
||||
show-input
|
||||
:show-input-controls="false"
|
||||
:min="50"
|
||||
:max="1024"
|
||||
/>
|
||||
<el-slider v-model="form.limit" show-input :show-input-controls="false" :min="50" :max="1024" />
|
||||
</div>
|
||||
<div class="form-item mb-16">
|
||||
<div class="title mb-8">自动清洗</div>
|
||||
@ -80,19 +66,19 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, reactive,watch } from 'vue'
|
||||
import { ref, computed, onMounted, reactive, watch } from 'vue'
|
||||
import ParagraphPreview from '@/views/dataset/component/ParagraphPreview.vue'
|
||||
import DatasetApi from '@/api/dataset'
|
||||
import useStore from '@/stores'
|
||||
import type { KeyValue } from '@/api/type/common'
|
||||
const { dataset } = useStore()
|
||||
const documentsFiles = computed(() => dataset.documentsFiles)
|
||||
const splitPatternList = ref<list<KeyValue>>([])
|
||||
const splitPatternList = ref<Array<KeyValue<string, string>>>([])
|
||||
|
||||
const radio = ref('1')
|
||||
const loading = ref(false)
|
||||
const paragraphList = ref<any[]>([])
|
||||
const patternLoading=ref<boolean>(false)
|
||||
const patternLoading = ref<boolean>(false)
|
||||
|
||||
const form = reactive<any>({
|
||||
patterns: [] as any,
|
||||
@ -124,13 +110,13 @@ function splitDocument() {
|
||||
}
|
||||
|
||||
const initSplitPatternList = () => {
|
||||
DatasetApi.listSplitPattern(patternLoading).then(ok=>{
|
||||
splitPatternList.value=ok.data
|
||||
DatasetApi.listSplitPattern(patternLoading).then(ok => {
|
||||
splitPatternList.value = ok.data
|
||||
})
|
||||
}
|
||||
|
||||
watch(radio,()=>{
|
||||
if(radio.value==='2'){
|
||||
watch(radio, () => {
|
||||
if (radio.value === '2') {
|
||||
initSplitPatternList()
|
||||
}
|
||||
})
|
||||
@ -146,6 +132,7 @@ defineExpose({
|
||||
<style scoped lang="scss">
|
||||
.set-rules {
|
||||
width: 100%;
|
||||
|
||||
.set-rules-height {
|
||||
height: var(--create-dataset-height);
|
||||
}
|
||||
@ -154,8 +141,10 @@ defineExpose({
|
||||
max-height: calc(var(--create-dataset-height) - 105px);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
&__radio {
|
||||
display: block;
|
||||
|
||||
.el-radio {
|
||||
white-space: break-spaces;
|
||||
width: 100%;
|
||||
@ -164,19 +153,23 @@ defineExpose({
|
||||
line-height: 22px;
|
||||
color: var(--app-text-color);
|
||||
}
|
||||
|
||||
:deep(.el-radio__label) {
|
||||
padding-left: 32px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-radio__input) {
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
&__form {
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user