wujingjing
2025-01-19 a85cba463afc431acb4b963348e249ed7916bfd8
src/components/chat/hooks/useSyncMsg.ts
@@ -4,6 +4,8 @@
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;
@@ -42,7 +44,17 @@
   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;