| | |
| | | import { useLoadData } from './hooks/useLoadData'; |
| | | import { useSyncMsg } from './hooks/useSyncMsg'; |
| | | import { getCurrentPosition } from '/@/utils/brower'; |
| | | import { deepClone } from '/@/utils/other'; |
| | | const containerRef = useCompRef(ChatContainer); |
| | | const chatListDom = computed(() => containerRef.value?.chatListDom); |
| | | const scrollToBottom = () => { |
| | |
| | | parseExtraContent, |
| | | convertProcessItem, |
| | | convertProcessToStep, |
| | | convertAttach, |
| | | formatShowTimeYear, |
| | | getStepGroupList, |
| | | } = useLoadData(); |
| | |
| | | for (const item of fileList) { |
| | | formDataParams.append('files', item.file); |
| | | } |
| | | clearAttach(); |
| | | // clearAttach(); |
| | | let lastTimestamp = new Date().getTime(); |
| | | questionRes = {}; |
| | | let lastIsResult = false; |
| | |
| | | triggerRefresh(); |
| | | return; |
| | | // chunkRes.value = '准备数据分析'; |
| | | } |
| | | |
| | | if (chunkRes.mode === 'create_work_order') { |
| | | const lastMsg = computedMessageList.value.at(-1); |
| | | lastMsg.modeContent = chunkRes; |
| | | triggerRefresh(); |
| | | return; |
| | | } |
| | | |
| | | if (chunkRes.mode === 'summary') { |
| | |
| | | |
| | | if (chunkRes.mode === 'conclusion') { |
| | | const lastReport = computedMessageList.value.at(-1)?.content?.values?.at(-1); |
| | | |
| | | if (lastReport) { |
| | | lastReport.conclusion = chunkRes.value; |
| | | chunkRes.value = '分析结束'; |
| | | } |
| | | chunkRes.value = '分析结束'; |
| | | |
| | | } |
| | | const getLastGroup = () => { |
| | | const lastGroup = computedMessageList.value.at(-1).stepGroup[0]; |
| | |
| | | |
| | | const addChatItem = (content: ChatContent) => { |
| | | isTalking.value = true; |
| | | const userItem: ChatMessage = { role: RoleEnum.user, content, isChecked: false } as any; |
| | | const userItem: ChatMessage = { role: RoleEnum.user, content, isChecked: false, attachList: deepClone(attachList.value) } as any; |
| | | const assistantItem: ChatMessage = { |
| | | role: RoleEnum.assistant, |
| | | content: { |
| | |
| | | isShow: true, |
| | | }, |
| | | ], |
| | | |
| | | isStopMsg: false, |
| | | isChecked: false, |
| | | } as any; |
| | |
| | | type: AnswerType.Text, |
| | | values: msgValue.question, |
| | | }, |
| | | attachList: convertAttach(msgValue), |
| | | isChecked: false, |
| | | }; |
| | | |