| | |
| | | type="text" |
| | | style="border-radius: 24px" |
| | | @click="visibleChange" |
| | | :disabled="!activeSessionId" |
| | | > |
| | | <icon-attachment |
| | | size="28" |
| | |
| | | import { onMounted, onBeforeMount, reactive, ref, computed, watch } from "vue"; |
| | | import axios from "axios"; |
| | | import { Message } from "@arco-design/web-vue"; |
| | | import { getParseMethodsListApi, uploadWithoutKb } from "@/api/session"; |
| | | import { addSessionApi, getParseMethodsListApi, getSessionDetailsApi, uploadWithoutKb } from "@/api/session"; |
| | | |
| | | const visible = ref(false); |
| | | const loading = ref(false); |
| | |
| | | return ".word, .pdf, .ppt, .excel, .txt, .zip, .rar, .7z, .doc, .docx, .xls, .xlsx, .pptx, .ppt, .pdf, .mp4, .avi, .mp3,.wav, .wma, .wmv, .rm,"; |
| | | }); |
| | | |
| | | |
| | | const getIconByExtension = (extension) => { |
| | | const fileExtension = ref(''); |
| | | fileExtension.value = extension.split('.').pop(); |
| | | parser_idsArr.value.forEach((item)=>{ |
| | | // 包含元素 |
| | | if (item.formats.includes(fileExtension.value)){ |
| | | return item.id; |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | const filterData = computed(() => { |
| | | const result = parser_ids.value.filter(val => parser_configs.value.includes(val.name)).reverse().slice(0,4).reverse(); |
| | | result.unshift({ |
| | |
| | | visible.value = !visible.value; |
| | | } |
| | | |
| | | const upDataFile = () => { |
| | | |
| | | const getIconByExtension = (extension) => { |
| | | const fileExtension = ref(''); |
| | | fileExtension.value = extension.split('.').pop(); |
| | | let type = ''; |
| | | parser_idsArr.value.forEach((item)=>{ |
| | | // 包含元素 |
| | | if (item.formats.includes(fileExtension.value)){ |
| | | type = item.id; |
| | | } |
| | | }) |
| | | return type; |
| | | }; |
| | | |
| | | const upDataFile = async () => { |
| | | // if (!activeSessionId.value) { |
| | | // //新建会话 |
| | | // const res = await addSessionApi({ |
| | | // dialog_id: '', |
| | | // conversation_desc: '', |
| | | // }); |
| | | // // console.log(res, "res"); |
| | | // if (res.code == 200) { |
| | | // // console.log(res.data.conversation_id); |
| | | // activeSessionId.value = res.data?.conversation_id; |
| | | // const { code, data } = await getSessionDetailsApi(res.data?.conversation_id); |
| | | // if (code === 200) { |
| | | // console.log(data, '新建会话详情'); |
| | | // } |
| | | // } else { |
| | | // Message.error('创建会话失败,请重试'); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | console.log(files.value, "files"); |
| | | console.log(parser_ids.value, "解析方法"); |
| | | if(files.value.length == 0){ |
| | |
| | | for (let i = 0; i < files.value.length; i++) { |
| | | formData.append('file', files.value[i].file); |
| | | formData.append('conversation_id', activeSessionId.value); |
| | | formData.append('parser_id', getIconByExtension(files.value[i].name)); |
| | | formData.append('parser_config', ''); |
| | | if(!parser_id.value){ |
| | | formData.append('parser_id', getIconByExtension(files.value[i].name)); |
| | | }else{ |
| | | formData.append('parser_id', parser_id.value); |
| | | } |
| | | } |
| | | uploadWithoutKb(formData).then((res) => { |
| | | onFileSelectedLoading.value = false; |
| | |
| | | Message.error('上传失败'); |
| | | } |
| | | }); |
| | | |
| | | // cancel(); |
| | | // emit('selectFileCallback', uploaditemList.value); |
| | | |
| | | |
| | | |