From bd639f00fe39d981c27203e7c4cdd0f3b92cb7d2 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期四, 31 十月 2024 15:06:35 +0800 Subject: [PATCH] 添加对话时间 --- src/components/chat/Chat.vue | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue index c5352f3..f881ca4 100644 --- a/src/components/chat/Chat.vue +++ b/src/components/chat/Chat.vue @@ -1,18 +1,19 @@ <template> <div class="flex h-full"> <div class="flex flex-col h-full flex-auto"> - <div ref="chatListDom" class="relative h-full flex flex-col items-center overflow-y-auto "> + <div ref="chatListDom" class="relative h-full flex flex-col items-center overflow-y-auto"> <span class="more-loading absolute text-blue-400 left-[50%] translate-x-[-50%] cursor-pointer w-10" v-loading="moreIsLoading" ></span> - <div class="h-full" v-loading="chatListLoading" :style="{ width: chatWidth }"> + <div class="h-full relative" v-loading="chatListLoading" :style="{ width: chatWidth }"> <div class="group flex px-4 py-6 hover:bg-slate-100 rounded-lg relative" :class="{ 'flex-row-reverse': item.role === RoleEnum.user }" v-for="(item, index) of computedMessageList" :key="`${item.historyId}_${item.role}`" > + <div class="absolute top-0 left-[72px] text-[#1c86ff]">{{ item?.createTime?.slice(5, 19) }}</div> <img class="rounded-full size-12 flex-0" :class="{ 'mr-4': item.role === RoleEnum.assistant, 'ml-4': item.role === RoleEnum.user }" @@ -143,7 +144,7 @@ </div> </div> - <div class="sticky bottom-0 w-full p-6 bg-[rgb(247,248,250)] flex justify-center"> + <div class="sticky bottom-0 w-full p-6 bg-[rgb(247,248,250)] flex justify-center"> <PlayBar v-model:voicePageIsShow="voicePageIsShow" :isTalking="isTalking" @@ -171,11 +172,20 @@ import { useScrollToBottom } from './hooks/useScrollToBottom'; import type { ChatContent } from './model/types'; import { AnswerState, AnswerType, RoleEnum, answerTypeMapCom, roleImageMap, type ChatMessage } from './model/types'; -import { GetHistoryAnswer, QuestionAi, extCallQuery } from '/@/api/ai/chat'; +import { QuestionAi, extCallQuery } from '/@/api/ai/chat'; import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue'; import CustomDrawer from '/@/components/drawer/CustomDrawer.vue'; import router from '/@/router'; -import { activeChatRoom, activeGroupType, activeLLMId, activeRoomId, activeSampleId, activeSectionAId, getRoomConfig, roomConfig } from '/@/stores/chatRoom'; +import { + activeChatRoom, + activeGroupType, + activeLLMId, + activeRoomId, + activeSampleId, + activeSectionAId, + getRoomConfig, + roomConfig, +} from '/@/stores/chatRoom'; import { ErrorCode } from '/@/utils/request'; const chatWidth = '75%'; @@ -193,7 +203,6 @@ const computedMessageList = computed(() => { return messageList.value.filter((v) => !!v); }); - const parseContent = (res) => { if (!res) return null; let content: ChatContent = { @@ -253,10 +262,8 @@ content.origin = res; return content; }; - const { clearQueryProcess, process, processId, queryProcess } = useQueryProcess(); const DEFAULT_SECTION_A_ID = 'knowledge_base'; - let questionRes = null; let finalCalcSectionAId = null; @@ -301,7 +308,7 @@ ...judgeParams, } as any; - if(activeGroupType.value){ + if (activeGroupType.value) { params.group_type = activeGroupType.value; } @@ -332,7 +339,6 @@ let currentSampleId = ''; let currentLLMId = null; - const sendChatMessage = async (content: ChatContent = messageContent.value, cb?: any, isCallExtParams?: any) => { if (!content?.values || isTalking.value || chatListLoading.value) return; -- Gitblit v1.9.3