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 |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue
index d853f77..f881ca4 100644
--- a/src/components/chat/Chat.vue
+++ b/src/components/chat/Chat.vue
@@ -6,13 +6,14 @@
 					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 }"
@@ -127,7 +128,7 @@
 							</div>
 						</div>
 					</div>
-					<div v-if="showAskMore" class="ml-4 mt-5 text-sm">
+					<div v-if="showAskMore" class="ml-4 mt-5 text-sm pb-10">
 						<div class="text-gray-600 mb-5">浣犲彲浠ョ户缁棶鎴戯細</div>
 						<div class="space-y-2 inline-flex flex-col">
 							<div
@@ -143,7 +144,7 @@
 				</div>
 			</div>
 
-			<div class="sticky bottom-0 w-full p-6 pb-8 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, activeLLMId, 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%';
@@ -187,12 +197,12 @@
 });
 const currentRoute = router.currentRoute;
 const currentRouteId = currentRoute.value.query.id as string;
+activeRoomId.value = currentRouteId;
 const chatListDom = ref<HTMLDivElement>();
 const messageList = ref<ChatMessage[]>([]);
 const computedMessageList = computed(() => {
 	return messageList.value.filter((v) => !!v);
 });
-
 const parseContent = (res) => {
 	if (!res) return null;
 	let content: ChatContent = {
@@ -252,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;
@@ -294,11 +302,15 @@
 		process_id: processId.value,
 		question: text,
 		// FIXME: 鏆傛椂杩欐牱
-		section_a_id: currentSectionAId,
+		// section_a_id: currentSectionAId,
 		history_group_id: currentRouteId,
 		raw_mode: roomConfig.value?.[currentRouteId]?.isAnswerByLLM ?? false,
 		...judgeParams,
 	} as any;
+
+	if (activeGroupType.value) {
+		params.group_type = activeGroupType.value;
+	}
 
 	if (currentSampleId) {
 		params.sample_id = currentSampleId;
@@ -327,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