| | |
| | | /> |
| | | </template> |
| | | <template #content> |
| | | <a-textarea |
| | | readonly |
| | | auto-size |
| | | v-model="displayedText" |
| | | :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{ |
| | | backgroundColor: |
| | | theme === 'light' ? '#ffffff' : '#000000', |
| | | }" |
| | | style="border: none" |
| | | > |
| | | </a-textarea> |
| | | <a-spin :loading="chartLoading" dot style="width: 100%"> |
| | | <a-textarea |
| | | readonly |
| | | auto-size |
| | | v-model="displayedText" |
| | | :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{ |
| | | backgroundColor: |
| | | theme === 'light' ? '#ffffff' : '#000000', |
| | | }" |
| | | style="border: none" |
| | | > |
| | | </a-textarea> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <template #actions> |
| | |
| | | ></updataFile> |
| | | <!-- <uploadFile |
| | | ref="fileInput" |
| | | :sessionId="activeSessionId" |
| | | :handleRemove="handleRemove" |
| | | :typeXLse="false" |
| | | @selectFileCallback="selectFileCallback" |
| | | ></uploadFile> --> |
| | | |
| | | <a-button |
| | | :disabled="chatDis" |
| | | @click="sentClick" |
| | |
| | | getSessionDetailsApi, |
| | | sessionListApi, |
| | | uploadWithoutKb, |
| | | uploadAndParse, |
| | | chatInfos, |
| | | chatRm, |
| | | } from '@/api/session'; |
| | | import { getAuthorization } from '@/utils/auth'; |
| | | import { queryCanvasList } from '@/api/Agent'; |
| | |
| | | const modalObj = reactive({ add: false }); |
| | | const dialogId = ref(''); |
| | | const chatDis = ref(false); |
| | | const chartLoading = ref(false); |
| | | const loading = ref(false); |
| | | const agentType = ref('1'); |
| | | const agentTitle = ref('未命名会话'); |
| | |
| | | // formRef.value.resetFields(); |
| | | }; |
| | | |
| | | const selectFileCallback = (data) => { |
| | | debugger; |
| | | console.log(data, 'selectFileCallback'); |
| | | const selectFileCallback = (data,conversation_id) => { |
| | | uploaditemList.value = [...uploaditemList.value, ...data]; |
| | | activeSessionId.value = conversation_id; |
| | | }; |
| | | |
| | | //上传 |
| | | // const selectFileCallback = async (resData, file) => { |
| | | // console.log(111); |
| | | // try { |
| | | // const formData = new FormData(); |
| | | // uploaditemList.value = resData; |
| | | // uploaditemList.value.map((item) => { |
| | | // if (item.name == file[0].file.name) { |
| | | // item.onFileSelectedLoading = true; |
| | | // item.textName = '上传中'; |
| | | // } |
| | | // return item; |
| | | // }); |
| | | // debugger; |
| | | // if (!activeSessionId.value) { |
| | | // await createSession(resData); |
| | | // } |
| | | |
| | | // // onFileSelectedLoading.value = true; |
| | | // // textName.value = '上传中'; |
| | | |
| | | // formData.append('files', file[0].file); |
| | | // formData.append('conversation_id', activeSessionId.value); |
| | | |
| | | // console.log(formData, 'formData'); |
| | | // const { data, code } = await uploadAndParse(formData); |
| | | // if (code === 200) { |
| | | // uploaditemList.value.map((item: any) => { |
| | | // item.onFileSelectedLoading = false; |
| | | // item.textName = '上传成功'; |
| | | // return item; |
| | | // }); |
| | | // getInfo(data); |
| | | // // onFileSelectedLoading.value = false; |
| | | // // textName.value = '上传成功'; |
| | | // } |
| | | // } catch (err) { |
| | | // uploaditemList.value.map((item: any) => { |
| | | // item.onFileSelectedLoading = false; |
| | | // item.textName = '上传失败'; |
| | | // return item; |
| | | // }); |
| | | // // onFileSelectedLoading.value = false; |
| | | // // textName.value = '上传失败'; |
| | | // Message.error('上传失败'); |
| | | // } |
| | | // }; |
| | | |
| | | //上传成功解析getinfo |
| | | const getInfo = async (id) => { |
| | | const { code, data } = await chatInfos({ |
| | | doc_ids: activeSessionId.value, |
| | | }); |
| | | if (code === 200) { |
| | | uploaditemList.value = data; |
| | | } |
| | | }; |
| | | //删除上传文档 |
| | | const deleteUpload = async (id) => { |
| | | const { code, data } = await chatRm({ |
| | | doc_id: id, |
| | | }); |
| | | if (code === 200) { |
| | | getInfo(); |
| | | } |
| | | }; |
| | | |
| | | let onFileSelectedLoading = ref(false); |
| | |
| | | const deleteFile = (item) => { |
| | | console.log(uploaditemList.value); |
| | | uploaditemList.value.splice(item.index, 1); |
| | | // EventBus.emit('queryAgent', item); |
| | | }; |
| | | |
| | | const { toClipboard } = useClipboard(); |
| | |
| | | console.log(name, '新建会话名称'); |
| | | |
| | | const res = await addSessionApi({ |
| | | dialog_id: id, |
| | | dialog_id: '', |
| | | conversation_desc: name, |
| | | }); |
| | | // console.log(res, "res"); |
| | |
| | | const startChat = async (valMsg) => { |
| | | chatDis.value = true; |
| | | loading.value = true; |
| | | chartLoading.value = true; |
| | | toStop = false; |
| | | sessionDetailList.value.push({ |
| | | content: valMsg, |
| | |
| | | if (typeof d !== 'boolean') { |
| | | // console.info("data:", d); |
| | | streamStr.value = d.content; |
| | | chartLoading.value = false; |
| | | startDisplayStr(); |
| | | } |
| | | } catch (e) { |
| | |
| | | if (done) { |
| | | console.info('done'); |
| | | displayedText.value = ''; |
| | | chartLoading.value = false; |
| | | if (isStopChat.value) { |
| | | setChatDataMeg(chatDataMeg); |
| | | } else { |
| | |
| | | activeSessionId.value = ''; |
| | | }); |
| | | onMounted(() => { |
| | | document.getElementsByTagName; |
| | | let container = document.getElementById('container'); |
| | | container.addEventListener('click', () => { |
| | | fileInput.value.cancel(); |
| | | // fileInput.value.cancel(); |
| | | }); |
| | | EventBus.on('newChat', () => { |
| | | agentType.value = '1'; |
| | |
| | | } |
| | | } |
| | | } |
| | | .uploadFileDis { |
| | | :deep(.arco-upload-list-type-text) { |
| | | display: none; |
| | | } |
| | | } |
| | | // .uploadFileDis { |
| | | // :deep(.arco-upload-list-type-text) { |
| | | // display: none; |
| | | // } |
| | | // } |
| | | .prompt { |
| | | ul { |
| | | margin: 0; |
| | |
| | | } |
| | | } |
| | | } |
| | | .uploadFileDis { |
| | | :deep(.arco-upload-list-type-text) { |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | .chat-item { |
| | | padding: 10px 0; |
| | |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | :deep(.arco-spin-loading .arco-spin-mask-icon) { |
| | | left: 10%; |
| | | } |
| | | } |
| | | |
| | | .right { |