diff --git a/src/model/ChatModel.js b/src/model/ChatModel.js index 28c4311..37a4483 100644 --- a/src/model/ChatModel.js +++ b/src/model/ChatModel.js @@ -53,6 +53,9 @@ export const CompName = { mapCard: "mapCard", // 回答卡片 longTextCard: "longTextCard", + longTextCardSnap: "longTextCardSnap", + longTextCardRoute: "longTextCardRoute", + longTextCardScenicSpot: "longTextCardScenicSpot", // 生成合成图片 aigcPhotoGeneratorCard: "aigcPhotoGeneratorCard", }; diff --git a/src/pages/ChatMain/ChatMainList/index.vue b/src/pages/ChatMain/ChatMainList/index.vue index 1f8c93d..e15cf69 100644 --- a/src/pages/ChatMain/ChatMainList/index.vue +++ b/src/pages/ChatMain/ChatMainList/index.vue @@ -60,7 +60,7 @@ class="flex flex-justify-start" :key="`ai-${item.msgId}-${item.msg ? item.msg.length : 0}`" :text=" - item.componentName && item.componentName === CompName.longTextCard + item.componentName && isLongTextCard(item.componentName) ? '' : item.msg || '' " @@ -70,12 +70,11 @@ #content v-if=" item.toolCall || - (item.componentName && - item.componentName === CompName.longTextCard) + (item.componentName && isLongTextCard(item.componentName)) " > @@ -844,7 +843,7 @@ const handleWebSocketMessage = (data) => { const aiItem = chatMsgList.value[aiMsgIndex]; if (data.componentName) { aiItem.componentName = data.componentName; - if (data.componentName === CompName.longTextCard) { + if (isLongTextCard(data.componentName)) { aiItem.longTextData = aiItem.longTextData || createLongTextData(); if (aiItem.msg && aiItem.msg.length > 0) { if (!aiItem.isLoading) { @@ -855,9 +854,7 @@ const handleWebSocketMessage = (data) => { } } - const isLongText = - aiItem.componentName === CompName.longTextCard || - data.componentName === CompName.longTextCard; + const isLongText = isLongTextCard(aiItem.componentName) || isLongTextCard(data.componentName); if (isLongText && data.contentKey) { aiItem.longTextData = aiItem.longTextData || createLongTextData(); @@ -949,6 +946,15 @@ const handleWebSocketMessage = (data) => { } }; +const isLongTextCard = (componentName) => { + return ( + componentName === CompName.longTextCard || + componentName === CompName.longTextCardSnap || + componentName === CompName.longTextCardRoute || + componentName === CompName.longTextCardScenicSpot + ); +}; + // 重置消息状态 const resetMessageState = () => { // 重置当前会话消息ID