wujingjing
2024-11-08 1711b75cf4e9f706be461c2be82edf760b28d3bd
src/components/chat/hooks/useScrollLoad.ts
@@ -4,12 +4,12 @@
import { AnswerType, ChatContent, ChatMessage, RoleEnum, StepEnum, StepItem } from '../model/types';
import { GetHistoryAnswer, QueryHistoryDetail, getShareChatJsonByPost } from '/@/api/ai/chat';
import router from '/@/router';
import { isSharePage } from '/@/stores/chatRoom';
type UseScrollLoadOption = {
   container: ShallowRef<HTMLDivElement>;
   historyGroupId: string | Ref<string>;
   messageList: Ref<ChatMessage[]>;
   parseAnswerContent: (res: any) => ChatContent;
   isSharePage: Ref<boolean>;
};
export const convertProcessItem = (processItem: any) => {
@@ -35,7 +35,7 @@
 * @returns
 */
export const useScrollLoad = (option: UseScrollLoadOption) => {
   const { container, historyGroupId, messageList, parseAnswerContent, isSharePage } = option;
   const { container, historyGroupId, messageList, parseAnswerContent } = option;
   const moreIsLoading = ref(false);
   /** @description 下次需要加载的用户结束索引(倒着数) */
@@ -118,7 +118,10 @@
      });
      const msgValue = res?.values;
      if (!msgValue) return undefined;
      if (!msgValue) {
         messageList.value = [];
         return;
      }
      const userMsg: ChatMessage = {
         historyId: msgValue.history_id,
         role: RoleEnum.user,