| | |
| | | <template #status="{ record }"> |
| | | <a-switch |
| | | v-model="record.status" |
| | | :disabled="!getAut('/kb/data_status')" |
| | | size="small" |
| | | checked-value="1" |
| | | unchecked-value="0" |
| | |
| | | <div style="display: flex; align-items: center"> |
| | | <div style="width: 100px"> |
| | | <a-popover title="" v-if="record.run == '4'"> |
| | | <a-tag |
| | | :loading="record.loading" |
| | | :color="'blue'" |
| | | border |
| | | >{{ $t('dmx.list.complete') }}</a-tag |
| | | <a-tag :loading="record.loading" :color="'red'" border |
| | | >失败</a-tag |
| | | > |
| | | <template #content> |
| | | <p>流程开始于:{{ record.process_begin_at }}</p> |
| | |
| | | type="text" |
| | | size="large" |
| | | @click="run(record)" |
| | | v-hasPermi="'/kb/data_analysis'" |
| | | :loading="record.loading" |
| | | > |
| | | <template #icon> |
| | |
| | | </div> |
| | | </template> |
| | | <template #action="{ record }"> |
| | | <a-button |
| | | type="text" |
| | | :disabled="record.run == '1'" |
| | | @click="handleClick(record)" |
| | | size="small" |
| | | > |
| | | <template #icon> |
| | | <icon-tool /> |
| | | </template> |
| | | </a-button> |
| | | <edit :item="record" @upTabdateItem="upTabdateItem" /> |
| | | <a-tooltip content="解析方法"> |
| | | <a-button |
| | | type="text" |
| | | :disabled="record.run == '1'" |
| | | @click="handleClick(record)" |
| | | v-hasPermi="'/kb/data_update'" |
| | | size="small" |
| | | > |
| | | <template #icon> |
| | | <icon-tool /> |
| | | </template> |
| | | </a-button> |
| | | </a-tooltip> |
| | | <edit |
| | | :item="record" |
| | | v-hasPermi="'/kb/rename'" |
| | | @upTabdateItem="upTabdateItem" |
| | | /> |
| | | <a-popconfirm |
| | | :content="'确定删除吗'" |
| | | type="warning" |
| | | @ok="deleteItem(record)" |
| | | > |
| | | <a-tooltip content="删除"> |
| | | <a-button |
| | | type="text" |
| | | size="small" |
| | | :disabled="record.run == '1'" |
| | | v-hasPermi="'/kb/data_delete'" |
| | | > |
| | | <template #icon> |
| | | <icon-delete /> |
| | | </template> |
| | | </a-button> |
| | | </a-tooltip> |
| | | </a-popconfirm> |
| | | <a-tooltip content="下载"> |
| | | <a-button |
| | | type="text" |
| | | size="small" |
| | | v-hasPermi="'/kb/data_download'" |
| | | :disabled="record.run == '1'" |
| | | @click="onDownloadDocument(record)" |
| | | > |
| | | <template #icon> |
| | | <icon-delete /> |
| | | <icon-download /> |
| | | </template> |
| | | </a-button> |
| | | </a-popconfirm> |
| | | <a-button |
| | | type="text" |
| | | size="small" |
| | | :disabled="record.run == '1'" |
| | | @click="onDownloadDocument(record)" |
| | | > |
| | | <template #icon> |
| | | <icon-download /> |
| | | </template> |
| | | </a-button> |
| | | </a-tooltip> |
| | | |
| | | <!-- <a-button |
| | | type="text" |
| | |
| | | </a-card> |
| | | </a-scrollbar> |
| | | </a-tab-pane> |
| | | <a-tab-pane key="2" :title="t('dmx.list.test')"> |
| | | <a-tab-pane |
| | | key="2" |
| | | :title="t('dmx.list.test')" |
| | | v-if="getAut('/kb/test')" |
| | | > |
| | | <a-scrollbar |
| | | class="rt-container-main" |
| | | :style="{ height: documentHeight + 70 + 'px' }" |
| | |
| | | <test ref="testForm"></test> |
| | | </a-scrollbar> |
| | | </a-tab-pane> |
| | | <a-tab-pane key="3" :title="t('dmx.list.disposition')"> |
| | | <a-tab-pane |
| | | key="3" |
| | | :title="t('dmx.list.disposition')" |
| | | v-if="getAut('/kb/update')" |
| | | > |
| | | <a-scrollbar |
| | | class="rt-container-main" |
| | | :style="{ height: documentHeight + 70 + 'px' }" |
| | |
| | | <!-- </div>--> |
| | | </div> |
| | | </div> |
| | | <a-modal title=" " v-model:visible="visible" :footer="false" fullscreen> |
| | | <!-- <docx previewSrc="http://192.168.20.116:1080/v1/document/get/405c3efa4d8c11ef97560242ac120006"></docx>--> |
| | | <docx v-if="documenttype == 'docx'" :previewSrc="previewSrc"></docx> |
| | | <excel v-if="documenttype == 'excel'" :previewSrc="previewSrc"></excel> |
| | | <txtPdf v-if="documenttype == 'txtPdf'" :previewSrc="previewSrc"></txtPdf> |
| | | </a-modal> |
| | | <!-- <a-modal title=" " v-model:visible="visible" :footer="false" fullscreen>--> |
| | | <!-- <!– <docx previewSrc="http://192.168.20.116:1080/v1/document/get/405c3efa4d8c11ef97560242ac120006"></docx>–>--> |
| | | <!-- <docx v-if="documenttype == 'docx'" :previewSrc="previewSrc"></docx>--> |
| | | <!-- <excel v-if="documenttype == 'excel'" :previewSrc="previewSrc"></excel>--> |
| | | <!-- <txtPdf v-if="documenttype == 'txtPdf'" :previewSrc="previewSrc"></txtPdf>--> |
| | | <!-- </a-modal>--> |
| | | <tool |
| | | ref="toolForm" |
| | | :kbtenantInfo="kbtenantInfo" |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { |
| | | computed, |
| | | ref, |
| | | reactive, |
| | | watch, |
| | | nextTick, |
| | | onBeforeMount, |
| | | onMounted, onBeforeUnmount |
| | | } from "vue"; |
| | | import { |
| | | computed, |
| | | ref, |
| | | reactive, |
| | | watch, |
| | | nextTick, |
| | | onBeforeMount, |
| | | onMounted, |
| | | onBeforeUnmount, |
| | | } from 'vue'; |
| | | import { useI18n } from 'vue-i18n'; |
| | | import useLoading from '@/hooks/loading'; |
| | | import { |
| | |
| | | import config from '@/views/dmx/knowledgeLib/config.vue'; |
| | | import test from '@/views/dmx/knowledgeLib/test.vue'; |
| | | import tool from '@/views/dmx/knowledgeLib/tool.vue'; |
| | | import docx from '@/views/dmx/knowledgeLib/components/docx.vue'; |
| | | import excel from '@/views/dmx/knowledgeLib/components/excel.vue'; |
| | | import txtPdf from '@/views/dmx/knowledgeLib/components/txtPdf.vue'; |
| | | // import docx from '@/views/dmx/knowledgeLib/components/docx.vue'; |
| | | // import excel from '@/views/dmx/knowledgeLib/components/excel.vue'; |
| | | // import txtPdf from '@/views/dmx/knowledgeLib/components/txtPdf.vue'; |
| | | import { Message, Modal } from '@arco-design/web-vue'; |
| | | import { documentHeight, parseTime } from '@/utils'; |
| | | import { deleteLlm } from '@/api/model'; |
| | | import { userModelState } from '@/store'; |
| | | import { getUserResources } from '@/utils/auth'; |
| | | |
| | | let modelStore = userModelState(); |
| | | const httpUrl = modelStore.hrefUrl; |
| | |
| | | parser_idObj: {}, |
| | | }); |
| | | let tabs = ref([]); |
| | | let timer = null;// 定时器 |
| | | |
| | | |
| | | let timer = null; // 定时器 |
| | | |
| | | const selectTab = (index, item) => { |
| | | selectedTab.value = index; |
| | |
| | | ...basePagination, |
| | | }); |
| | | getKbdetail(kbobj.id); |
| | | }; |
| | | |
| | | const getAut = (val) => { |
| | | const roleData = JSON.parse(getUserResources()); |
| | | const roleBtn = roleData.map((item: any) => item.component); |
| | | return roleBtn.includes(val); |
| | | }; |
| | | |
| | | const basePagination: Pagination = { |
| | |
| | | pagination.current = params.page; |
| | | pagination.total = data.data.total; |
| | | |
| | | if(timer){ |
| | | if (timer) { |
| | | clearInterval(timer); |
| | | } |
| | | // 定时器查询文档 |
| | | timer = setInterval(async () => { |
| | | let params = { ...basePagination, kb_id: kbobj.id } |
| | | let params = { ...basePagination, kb_id: kbobj.id }; |
| | | const data = await queryKbDocumentList(params); |
| | | if (data.code == '0') { |
| | | parser_ids = kbtenantInfo.parser_ids.split(',').reduce((acc, pair) => { |
| | | const [key, value] = pair.split(':'); |
| | | acc[key] = value; |
| | | return acc; |
| | | }, {}); |
| | | parser_ids = kbtenantInfo.parser_ids |
| | | .split(',') |
| | | .reduce((acc, pair) => { |
| | | const [key, value] = pair.split(':'); |
| | | acc[key] = value; |
| | | return acc; |
| | | }, {}); |
| | | // console.log(parser_ids, 'parser_ids'); |
| | | kbtenantInfo.parser_idObj = parser_ids; |
| | | renderData.value = data.data.docs || []; |
| | |
| | | // console.log(renderData.value, 'renderData'); |
| | | } |
| | | }, 10000); |
| | | |
| | | |
| | | } |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | |
| | | setLoading(true); |
| | | try { |
| | | const { data } = await queryKbList({ page: 1, page_size: 10 }); |
| | | |
| | | console.log(data, '查询知识库列表'); |
| | | tabs.value = data; |
| | | if (tabs.value.length > 0) { |
| | | // 定位到新增的知识库单元 |
| | | selectedTab.value = tabs.value.findIndex((item) => item.id == id); |
| | | getKbdetail(id); // 获取详情 |
| | | kbobj.id = id; |
| | | activeKey.value = '3'; |
| | | } |
| | | } catch (err) { |
| | |
| | | kb_id: tabs.value[selectedTab.value].id, |
| | | ...basePagination, |
| | | }); |
| | | |
| | | |
| | | |
| | | } else { |
| | | // Message.error('解析失败'); |
| | | // row.run = '1'; |
| | |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | clearInterval(timer); |
| | | }) |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |