feat:增加几种长文本组件

This commit is contained in:
2026-05-21 15:59:43 +08:00
parent d087ee6b35
commit a2c814481c
2 changed files with 17 additions and 8 deletions

View File

@@ -53,6 +53,9 @@ export const CompName = {
mapCard: "mapCard",
// 回答卡片
longTextCard: "longTextCard",
longTextCardSnap: "longTextCardSnap",
longTextCardRoute: "longTextCardRoute",
longTextCardScenicSpot: "longTextCardScenicSpot",
// 生成合成图片
aigcPhotoGeneratorCard: "aigcPhotoGeneratorCard",
};

View File

@@ -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))
"
>
<AnswerComponent
v-if="item.componentName === CompName.longTextCard"
v-if="isLongTextCard(item.componentName)"
:longTextData="item.longTextData"
:finish="item.finish"
/>
@@ -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