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 | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue index 90e770b..afa902f 100644 --- a/src/components/chat/Chat.vue +++ b/src/components/chat/Chat.vue @@ -50,13 +50,13 @@ v-if="item.role === RoleEnum.assistant && item.content.origin?.ext_call_list" class="flex font-bold items-center mt-6" > - <div class="flex-0 mr-1.5">鍏宠仈鍔熻兘锛�</div> - <div class="flex-0 space-x-5 flex"> + <div class="flex-0 mb-auto -mr-4">鍏宠仈鍔熻兘锛�</div> + <div class="space-x-5 flex flex-wrap"> <div v-for="callItem in item.content.origin?.ext_call_list" :key="callItem.call_ext_id" @click="relativeQueryClick(callItem)" - class="flex-0 cursor-pointer hover:underline" + class="cursor-pointer hover:underline first-of-type:ml-5" > {{ callItem.question }} </div> @@ -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, @@ -339,7 +353,6 @@ const extRes = await extCallQuery(isCallExtParams); questionRes = extRes; resMsgContent = parseContent(extRes); - } else { resMsgContent = await questionAi(content.values); } -- Gitblit v1.9.3