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