| | |
| | | import { RoleEnum, type ChatMessage } from '../model/types'; |
| | | import { QueryHistoryDetail } from '/@/api/ai/chat'; |
| | | import { sseClient } from '/@/stores/global'; |
| | | import { Logger } from '/@/model/logger/Logger'; |
| | | import { ElNotification } from 'element-plus'; |
| | | |
| | | type UseSyncMsgOptions = { |
| | | updateLoadIndex: (addCount: number) => void; |
| | |
| | | const historyUpdate = async (data: any) => { |
| | | if (!checkCanSync(data)) return; |
| | | if (!data) return; |
| | | Logger.info('sync message notification:\n\n' + JSON.stringify(data)); |
| | | |
| | | if (data?.type === 'chat_start') { |
| | | const fromTitle = data?.from || '未知端'; |
| | | ElNotification({ |
| | | title: fromTitle, |
| | | message: `正在处理新的提问,请耐心等待,对话完成后会自动同步`, |
| | | type: 'info', |
| | | duration: 4000, |
| | | }); |
| | | } |
| | | if (data?.type === 'chat_history_id') { |
| | | const groupId = unref(historyGroupId); |
| | | if (!groupId) return; |