feat: 格式化了对话页的代码

This commit is contained in:
zoujing 2025-08-12 18:35:06 +08:00
parent 80fc947bbf
commit 49e8332fc0

View File

@ -38,23 +38,28 @@
<template v-if="item.msgType === MessageRole.AI">
<ChatCardAI
class="message-item-ai"
:key="`ai-${item.msgId}-${item.msg ? item.msg.length : 0}`"
:key="`ai-${item.msgId}-${
item.msg ? item.msg.length : 0
}`"
:text="item.msg || ''"
>
<template #content v-if="item.toolCall">
<QuickBookingComponent
v-if="
item.toolCall.componentName === CompName.quickBookingCard
item.toolCall.componentName ===
CompName.quickBookingCard
"
/>
<DiscoveryCardComponent
v-else-if="
item.toolCall.componentName === CompName.discoveryCard
item.toolCall.componentName ===
CompName.discoveryCard
"
/>
<CreateServiceOrder
v-else-if="
item.toolCall.componentName === CompName.createWorkOrderCard
item.toolCall.componentName ===
CompName.createWorkOrderCard
"
/>
<DetailCardCompontent
@ -77,12 +82,18 @@
</template>
<template v-else-if="item.msgType === MessageRole.ME">
<ChatCardMine class="message-item-mine" :text="item.msg">
<ChatCardMine
class="message-item-mine"
:text="item.msg"
>
</ChatCardMine>
</template>
<template v-else>
<ChatCardOther class="message-item-other" :text="item.msg">
<ChatCardOther
class="message-item-other"
:text="item.msg"
>
<ChatMoreTips
@replySent="handleReply"
:itemList="mainPageDataModel.guideWords"
@ -94,8 +105,12 @@
/>
<RecommendPostsComponent
v-if="mainPageDataModel.recommendTheme.length > 0"
:recommendThemeList="mainPageDataModel.recommendTheme"
v-if="
mainPageDataModel.recommendTheme.length > 0
"
:recommendThemeList="
mainPageDataModel.recommendTheme
"
/>
</ChatCardOther>
</template>
@ -417,11 +432,11 @@ const handleWebSocketMessage = (data) => {
}
const msg = chatMsgList.value[aiMsgIndex].msg;
console.log('全量消息内容:', msg)
if (!msg || msg === '加载中.' || msg.startsWith('加载中')) {
chatMsgList.value[aiMsgIndex].msg = '未获取到内容,请重试';
console.log("全量消息内容:", msg);
if (!msg || msg === "加载中." || msg.startsWith("加载中")) {
chatMsgList.value[aiMsgIndex].msg = "未获取到内容,请重试";
if (data.toolCall) {
chatMsgList.value[aiMsgIndex].msg = '';
chatMsgList.value[aiMsgIndex].msg = "";
}
}