From d257f90aecbd2ae44de5bf19489b3e82943cb712 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 05 十二月 2024 13:42:02 +0800 Subject: [PATCH] 滚动置底部 --- src/components/chat/hooks/useScrollLoad.ts | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/chat/hooks/useScrollLoad.ts b/src/components/chat/hooks/useScrollLoad.ts index 7a6108f..4a8b0ec 100644 --- a/src/components/chat/hooks/useScrollLoad.ts +++ b/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 涓嬫闇�瑕佸姞杞界殑鐢ㄦ埛缁撴潫绱㈠紩锛堝�掔潃鏁帮級 */ @@ -99,6 +99,8 @@ createTime: answerTime, stepList: convertProcessToStep(item?.answer?.exec_process), stepIsShow: false, + isStopMsg: false, + conclusion: item?.answer?.conclusion ?? [], isChecked: false, } @@ -118,7 +120,10 @@ }); const msgValue = res?.values; - if (!msgValue) return undefined; + if (!msgValue) { + messageList.value = []; + return; + } const userMsg: ChatMessage = { historyId: msgValue.history_id, role: RoleEnum.user, @@ -135,6 +140,8 @@ content: parseAnswerContent(msgValue), stepList: convertProcessToStep(msgValue.exec_process), stepIsShow: false, + isStopMsg: false, + conclusion: msgValue.conclusion ?? [], isChecked: false, }; -- Gitblit v1.9.3