|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <a-button type="text" @click="handleClick" size="small"> | 
|---|
|  |  |  | <a-button type="text"  :disabled="props.item.run == '1'" @click="handleClick" size="small"> | 
|---|
|  |  |  | <template #icon> | 
|---|
|  |  |  | <icon-tool /> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-tabs default-active-key="1"> | 
|---|
|  |  |  | <a-tab-pane key="1"> | 
|---|
|  |  |  | <template #title> <icon-calendar /> 解析方法 </template> | 
|---|
|  |  |  | <template #title> | 
|---|
|  |  |  | <icon-calendar /> | 
|---|
|  |  |  | 解析方法 | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | <div style="width: 100%"> | 
|---|
|  |  |  | <div style="display: flex; align-items: center"> | 
|---|
|  |  |  | <div> 解析方法: </div> | 
|---|
|  |  |  | <div> 解析方法:</div> | 
|---|
|  |  |  | <div style="margin-left: 10px"> | 
|---|
|  |  |  | <a-select v-model="form.parser_id" placeholder="请选择"> | 
|---|
|  |  |  | <a-option | 
|---|
|  |  |  | 
|---|
|  |  |  | auto-label-width | 
|---|
|  |  |  | @submit="handleSubmit" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-divider style="margin-top: 10px" /> | 
|---|
|  |  |  | <a-form-item field="slider" label="块Token数"> | 
|---|
|  |  |  | <a-divider | 
|---|
|  |  |  | style="margin-top: 10px" | 
|---|
|  |  |  | v-if="form.parser_id === 'naive'" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | field="slider" | 
|---|
|  |  |  | label="块Token数" | 
|---|
|  |  |  | v-if="form.parser_id === 'naive'" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-slider | 
|---|
|  |  |  | v-model="form.chunk_token_num" | 
|---|
|  |  |  | :min="0" | 
|---|
|  |  |  | 
|---|
|  |  |  | show-input | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-divider style="margin-top: 10px" /> | 
|---|
|  |  |  | <a-form-item field="raptor" label="使用召回增强RAPTOR策略"> | 
|---|
|  |  |  | <a-space direction="vertical" size="large"> | 
|---|
|  |  |  | <a-switch | 
|---|
|  |  |  | v-model="form.use_raptor" | 
|---|
|  |  |  | @change="onChangeRAPTOR" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-space> | 
|---|
|  |  |  | <a-divider | 
|---|
|  |  |  | style="margin-top: 10px" | 
|---|
|  |  |  | v-if=" | 
|---|
|  |  |  | form.parser_id === 'naive' || | 
|---|
|  |  |  | form.parser_id === 'qa' || | 
|---|
|  |  |  | form.parser_id === 'manual' || | 
|---|
|  |  |  | form.parser_id === 'laws' || | 
|---|
|  |  |  | form.parser_id === 'book' | 
|---|
|  |  |  | " | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | field="raptor" | 
|---|
|  |  |  | label="使用召回增强RAPTOR策略" | 
|---|
|  |  |  | v-if=" | 
|---|
|  |  |  | form.parser_id === 'naive' || | 
|---|
|  |  |  | form.parser_id === 'qa' || | 
|---|
|  |  |  | form.parser_id === 'manual' || | 
|---|
|  |  |  | form.parser_id === 'laws' || | 
|---|
|  |  |  | form.parser_id === 'book' | 
|---|
|  |  |  | " | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-switch | 
|---|
|  |  |  | v-model="form.use_raptor" | 
|---|
|  |  |  | @change="onChangeRAPTOR" | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <div v-if="form.use_raptor"> | 
|---|
|  |  |  | <a-form-item field="prompt" label="提示词"> | 
|---|
|  |  |  | 
|---|
|  |  |  | style="margin-left: 10px" | 
|---|
|  |  |  | type="primary" | 
|---|
|  |  |  | html-type="submit" | 
|---|
|  |  |  | >确定</a-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | >确定 | 
|---|
|  |  |  | </a-button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | </a-form> | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </a-tab-pane> | 
|---|
|  |  |  | <a-tab-pane key="2"> | 
|---|
|  |  |  | <template #title> <icon-clock-circle /> 创建解析块 </template> | 
|---|
|  |  |  | <template #title> | 
|---|
|  |  |  | <icon-clock-circle /> | 
|---|
|  |  |  | 创建解析块 | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | <div class="details"> | 
|---|
|  |  |  | <div class="details-header"> | 
|---|
|  |  |  | <div | 
|---|
|  |  |  | 
|---|
|  |  |  | type="outline" | 
|---|
|  |  |  | class="button" | 
|---|
|  |  |  | style="margin-right: 10px" | 
|---|
|  |  |  | >批量<icon-down style="margin-left: 4px" | 
|---|
|  |  |  | /></a-button> | 
|---|
|  |  |  | >批量 | 
|---|
|  |  |  | <icon-down style="margin-left: 4px" /> | 
|---|
|  |  |  | </a-button> | 
|---|
|  |  |  | <template #content> | 
|---|
|  |  |  | <a-space direction="vertical"> | 
|---|
|  |  |  | <a-checkbox | 
|---|
|  |  |  | 
|---|
|  |  |  | type="outline" | 
|---|
|  |  |  | class="button" | 
|---|
|  |  |  | style="margin-right: 10px" | 
|---|
|  |  |  | ><icon-sort | 
|---|
|  |  |  | /></a-button> | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <icon-sort /> | 
|---|
|  |  |  | </a-button> | 
|---|
|  |  |  | <template #content> | 
|---|
|  |  |  | <a-radio-group | 
|---|
|  |  |  | v-model="available_int" | 
|---|
|  |  |  | 
|---|
|  |  |  | <div | 
|---|
|  |  |  | class="groupList" | 
|---|
|  |  |  | :class="{ | 
|---|
|  |  |  | groupActive: keyBg == '1', | 
|---|
|  |  |  | groupNoActive: keyBg != '1', | 
|---|
|  |  |  | groupActive: keyBg == index, | 
|---|
|  |  |  | groupNoActive: keyBg != index, | 
|---|
|  |  |  | }" | 
|---|
|  |  |  | v-for="(item, index) in listData" | 
|---|
|  |  |  | :key="index" | 
|---|
|  |  |  | 
|---|
|  |  |  | <a-checkbox :value="item.chunk_id"></a-checkbox> | 
|---|
|  |  |  | <div | 
|---|
|  |  |  | class="groupList-content emphaRed" | 
|---|
|  |  |  | @click="groupListContentClick('1')" | 
|---|
|  |  |  | @dblclick="contentClick(1)" | 
|---|
|  |  |  | @click="groupListContentClick(index)" | 
|---|
|  |  |  | @dblclick="contentClick(item)" | 
|---|
|  |  |  | v-html="item.content_with_weight" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | :checked-value="1" | 
|---|
|  |  |  | :unchecked-value="0" | 
|---|
|  |  |  | @change="handleChangeStatus(item)" | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | </a-spin> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <eidtDetails ref="eidtDil"></eidtDetails> | 
|---|
|  |  |  | <eidtDetails | 
|---|
|  |  |  | ref="eidtDil" | 
|---|
|  |  |  | :item="eidtDilinfo" | 
|---|
|  |  |  | v-model:eidtDilVisible="eidtDilVisible" | 
|---|
|  |  |  | @canplaythrough="canplaythrough" | 
|---|
|  |  |  | ></eidtDetails> | 
|---|
|  |  |  | </a-tab-pane> | 
|---|
|  |  |  | </a-tabs> | 
|---|
|  |  |  | </a-modal> | 
|---|
|  |  |  | 
|---|
|  |  |  | queryChunkList, | 
|---|
|  |  |  | chunkSwitch, | 
|---|
|  |  |  | chunkRm, | 
|---|
|  |  |  | achunkGet, | 
|---|
|  |  |  | } from '@/api/kbList'; | 
|---|
|  |  |  | import addDetails from '@/views/dmx/knowledgeLib/addDetails.vue'; | 
|---|
|  |  |  | import eidtDetails from '@/views/dmx/knowledgeLib/eidtDetails.vue'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const visible = ref(false); | 
|---|
|  |  |  | const loading = ref(false); | 
|---|
|  |  |  | const radio = ref('1'); | 
|---|
|  |  |  | const keyBg = ref(''); | 
|---|
|  |  |  | const eidtDil = ref(); | 
|---|
|  |  |  | const eidtDilVisible = ref(false); | 
|---|
|  |  |  | const eidtDilinfo = reactive({}); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const props = defineProps(['kbtenantInfo', 'item', 'kbdetail']); | 
|---|
|  |  |  | // const emit =  defineEmits(['upTabdateItem']) | 
|---|
|  |  |  | 
|---|
|  |  |  | value: value1, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 过滤解析方法 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const filterParserArr = [ | 
|---|
|  |  |  | 'naive', | 
|---|
|  |  |  | 'qa', | 
|---|
|  |  |  | 'resume', | 
|---|
|  |  |  | 'manual', | 
|---|
|  |  |  | 'book', | 
|---|
|  |  |  | 'laws', | 
|---|
|  |  |  | 'one', | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const isBtn = ref(true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const form = reactive({ | 
|---|
|  |  |  | parser_id: props.item.parser_id, | 
|---|
|  |  |  | parser_id: '', | 
|---|
|  |  |  | doc_id: props.item.id, | 
|---|
|  |  |  | max_token: 698, | 
|---|
|  |  |  | threshold: 0.3, | 
|---|
|  |  |  | 
|---|
|  |  |  | const formatter = (value) => { | 
|---|
|  |  |  | return value / 100; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function randomNumber() { | 
|---|
|  |  |  | // 生成一个介于min和max之间的随机整数(包含min和max) | 
|---|
|  |  |  | const min = 1; // 最小值 | 
|---|
|  |  |  | 
|---|
|  |  |  | visible.value = false; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const contentClick = (done) => { | 
|---|
|  |  |  | eidtDil.value.handleClick(); | 
|---|
|  |  |  | const contentClick = async (item) => { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | const data = await achunkGet({ | 
|---|
|  |  |  | chunk_id: item.chunk_id, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // console.log(data.data); | 
|---|
|  |  |  | Object.assign(eidtDilinfo, data.data); | 
|---|
|  |  |  | eidtDilVisible.value = true; | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | Message.error('获取失败'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | const handleOpened = (el) => { | 
|---|
|  |  |  | // console.log('props',props.kbtenantInfo); | 
|---|
|  |  |  | // console.log('props',props.item); | 
|---|
|  |  |  | console.log('props', props.item); | 
|---|
|  |  |  | // console.log('props',props.kbdetail); | 
|---|
|  |  |  | console.log(parser_ids, 'parser_ids'); | 
|---|
|  |  |  | let parser_id = props.item.parser_id; | 
|---|
|  |  |  | parser_ids.forEach((item) => { | 
|---|
|  |  |  | if (item.name == parser_id) { | 
|---|
|  |  |  | form.parser_id = item.value; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // Object.assign(form,{ | 
|---|
|  |  |  | //   name: '',// 用户名 | 
|---|
|  |  |  | //   nameJoin: '',// 昵称 | 
|---|
|  |  |  | 
|---|
|  |  |  | // 自定义加载提示文本 | 
|---|
|  |  |  | const tip = '加载中,请稍候...'; | 
|---|
|  |  |  | //获取列表 | 
|---|
|  |  |  | const getList = () => { | 
|---|
|  |  |  | const getList = async () => { | 
|---|
|  |  |  | let params = { | 
|---|
|  |  |  | doc_id: props.item.id, | 
|---|
|  |  |  | keywords: form.keywords, | 
|---|
|  |  |  | 
|---|
|  |  |  | if (available_int.value !== '') { | 
|---|
|  |  |  | params.available_int = available_int.value; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryChunkList(params).then((res) => { | 
|---|
|  |  |  | await queryChunkList(params).then((res) => { | 
|---|
|  |  |  | if (res.code == 0) { | 
|---|
|  |  |  | listData.value = res.data.chunks; | 
|---|
|  |  |  | isLoading.value = false; | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | onBeforeMount(() => {}); | 
|---|
|  |  |  | onMounted(() => { | 
|---|
|  |  |  | onBeforeMount(() => { | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | onMounted(() => {}); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style scoped lang="less"> | 
|---|
|  |  |  | .parser { | 
|---|
|  |  |  | width: 100%; | 
|---|
|  |  |  | ::v-deep .arco-btn-outline:hover, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .arco-btn-outline:hover, | 
|---|
|  |  |  | .arco-btn-outline, | 
|---|
|  |  |  | .arco-btn-outline[type='button'] { | 
|---|
|  |  |  | color: #2a2a2b; | 
|---|
|  |  |  | border: 1px solid #2a2a2b; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .button { | 
|---|
|  |  |  | //color: #2a2a2b!important; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ::-webkit-scrollbar { | 
|---|
|  |  |  | display: none; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .groupMain { | 
|---|
|  |  |  | width: 100%; | 
|---|
|  |  |  | height: 500px; | 
|---|
|  |  |  | overflow: auto; | 
|---|
|  |  |  | display: flex; | 
|---|
|  |  |  | justify-content: center; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .groupList { | 
|---|
|  |  |  | display: flex; | 
|---|
|  |  |  | padding: 24px; | 
|---|
|  |  |  | 
|---|
|  |  |  | border: 1px solid #f0f0f0; | 
|---|
|  |  |  | margin-bottom: 20px; | 
|---|
|  |  |  | overflow: auto; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .groupList-content { | 
|---|
|  |  |  | width: 700px; | 
|---|
|  |  |  | //height: 100px; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | :deep(.emphaRed em) { | 
|---|
|  |  |  | color: red !important; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | .groupActive { | 
|---|
|  |  |  | background: #eff8ff; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .groupNoActive { | 
|---|
|  |  |  | background: var(--color-bg-1); | 
|---|
|  |  |  | color: var(--color-text-1); | 
|---|