| | |
| | | </div> |
| | | </div> |
| | | |
| | | <Loding v-else class="w-fit" :process="process" /> |
| | | <Loding v-if="isTalking && index === messageList.length - 1" class="w-fit" :process="process" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | ElMessage.warning('发送失败,未确定应用场景!'); |
| | | } |
| | | processId.value = uuidv4(); |
| | | const judgeParams = !preQuestion.value |
| | | ? {} |
| | | : { |
| | | prev_question: preQuestion.value, |
| | | }; |
| | | let judgeParams = null; |
| | | if (!preQuestion.value) { |
| | | // const aiContent = computedMessageList.value.filter((item) => item.role === RoleEnum.assistant); |
| | | // const lastQuestion = aiContent[aiContent.length - 2]?.content?.origin?.question; |
| | | // judgeParams = lastQuestion |
| | | // ? { |
| | | // prev_question: lastQuestion, |
| | | // } |
| | | // : {}; |
| | | // 正常回答暂时不采用 |
| | | judgeParams = {}; |
| | | } else { |
| | | judgeParams = { |
| | | prev_question: preQuestion.value, |
| | | }; |
| | | } |
| | | |
| | | const params = { |
| | | process_id: processId.value, |
| | | question: text, |
| | |
| | | }; |
| | | |
| | | const sendChatMessage = async (content: ChatContent = messageContent.value, cb?: any, isCallExtParams?: any) => { |
| | | if (!content?.values) return; |
| | | if (!content?.values || isTalking.value) return; |
| | | const isNewChat = messageList.value.length === 0; |
| | | if (isNewChat) { |
| | | if (activeSampleId.value) { |
| | |
| | | cb?.(resMsgContent); |
| | | } |
| | | userItem.historyId = questionRes.history_id; |
| | | userItem.content.values = questionRes?.question ?? userItem.content.values; |
| | | assistantItem.historyId = questionRes.history_id; |
| | | appendLastMessageContent(resMsgContent); |
| | | } catch (error: any) { |
| | |
| | | currentSampleId = res?.details?.[0]?.sample_id; |
| | | const resList = await Promise.all((res.details ?? []).map((item) => getAnswerById(item.history_id))); |
| | | let i = 0; |
| | | |
| | | resList.map((item, index) => { |
| | | const insertIndex = index + 1 + i; |
| | | const userMsg = messageList.value[insertIndex - 1]; |
| | | userMsg.content.values = item?.answer?.question ??userMsg.content.values; |
| | | messageList.value.splice( |
| | | insertIndex, |
| | | 0, |