From 4bb81cc9f52eedf94a17a6318f57b785b0e02005 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期一, 19 八月 2024 09:53:03 +0800
Subject: [PATCH] prev_question test

---
 src/components/chat/Chat.vue |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue
index d9328d5..afa902f 100644
--- a/src/components/chat/Chat.vue
+++ b/src/components/chat/Chat.vue
@@ -257,11 +257,25 @@
 		ElMessage.warning('鍙戦�佸け璐ワ紝鏈‘瀹氬簲鐢ㄥ満鏅紒');
 	}
 	processId.value = uuidv4();
-	const judgeParams = !preQuestion.value
-		? {}
-		: {
-				prev_question: preQuestion.value,
-		  };
+	let judgeParams = null;
+	if (!preQuestion.value) {
+		const userContent = computedMessageList.value.filter((item) => item.role === RoleEnum.user);
+		const lastQuestion = userContent[userContent.length - 2]?.content?.values;
+		judgeParams = lastQuestion
+			? {
+					prev_question: lastQuestion,
+			  }
+			: {};
+	} else {
+		judgeParams = {
+			prev_question: preQuestion.value,
+		};
+	}
+	// const judgeParams = !preQuestion.value
+	// 	? {}
+	// 	: {
+	// 			prev_question: preQuestion.value,
+	// 	  };
 	const params = {
 		process_id: processId.value,
 		question: text,

--
Gitblit v1.9.3