| | |
| | | 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 = () => { |
| | |
| | | params.tables = JSON.stringify(tableList); |
| | | } |
| | | |
| | | const metricList = attachList.value.filter((item) => item.type === 'metric').map((item) => item.model); |
| | | if (metricList?.length > 0) { |
| | | params.metrics = JSON.stringify(metricList); |
| | | } |
| | | // if (!position) { |
| | | // const loadingInstance = ElLoadingService({ |
| | | // text: '获取位置中...', |
| | |
| | | // chunkRes.value = '准备数据分析'; |
| | | } |
| | | |
| | | if (chunkRes.mode === 'create_work_order') { |
| | | const lastMsg = computedMessageList.value.at(-1); |
| | | lastMsg.modeContent = chunkRes; |
| | | triggerRefresh(); |
| | | return; |
| | | } |
| | | |
| | | if (chunkRes.mode === 'summary') { |
| | | const lastMsg = computedMessageList.value.at(-1); |
| | | const extraContent = parseExtraContent(chunkRes.value); |
| | |
| | | |
| | | if (chunkRes.mode === 'conclusion') { |
| | | const lastReport = computedMessageList.value.at(-1)?.content?.values?.at(-1); |
| | | chunkRes.value = '分析结束'; |
| | | |
| | | if (lastReport) { |
| | | lastReport.conclusion = chunkRes.value; |
| | | } |
| | | chunkRes.value = '分析结束'; |
| | | |
| | | } |
| | | const getLastGroup = () => { |
| | | const lastGroup = computedMessageList.value.at(-1).stepGroup[0]; |
| | |
| | | lastAxiosSource?.cancel(); |
| | | isTalking.value = false; |
| | | chatListLoading.value = false; |
| | | |
| | | streamOutputIsStart = false; |
| | | computedMessageList.value.at(-1).isStopMsg = true; |
| | | }; |
| | | |
| | |
| | | |
| | | const addChatItem = (content: ChatContent) => { |
| | | isTalking.value = true; |
| | | const userItem: ChatMessage = { role: RoleEnum.user, content, isChecked: false, attachList: attachList.value } as any; |
| | | const userItem: ChatMessage = { role: RoleEnum.user, content, isChecked: false, attachList: deepClone(attachList.value) } as any; |
| | | const assistantItem: ChatMessage = { |
| | | role: RoleEnum.assistant, |
| | | content: { |