feat: 格式化了对话页的代码
This commit is contained in:
@@ -38,23 +38,28 @@
|
|||||||
<template v-if="item.msgType === MessageRole.AI">
|
<template v-if="item.msgType === MessageRole.AI">
|
||||||
<ChatCardAI
|
<ChatCardAI
|
||||||
class="message-item-ai"
|
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 || ''"
|
:text="item.msg || ''"
|
||||||
>
|
>
|
||||||
<template #content v-if="item.toolCall">
|
<template #content v-if="item.toolCall">
|
||||||
<QuickBookingComponent
|
<QuickBookingComponent
|
||||||
v-if="
|
v-if="
|
||||||
item.toolCall.componentName === CompName.quickBookingCard
|
item.toolCall.componentName ===
|
||||||
|
CompName.quickBookingCard
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<DiscoveryCardComponent
|
<DiscoveryCardComponent
|
||||||
v-else-if="
|
v-else-if="
|
||||||
item.toolCall.componentName === CompName.discoveryCard
|
item.toolCall.componentName ===
|
||||||
|
CompName.discoveryCard
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<CreateServiceOrder
|
<CreateServiceOrder
|
||||||
v-else-if="
|
v-else-if="
|
||||||
item.toolCall.componentName === CompName.createWorkOrderCard
|
item.toolCall.componentName ===
|
||||||
|
CompName.createWorkOrderCard
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<DetailCardCompontent
|
<DetailCardCompontent
|
||||||
@@ -77,12 +82,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="item.msgType === MessageRole.ME">
|
<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>
|
</ChatCardMine>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<ChatCardOther class="message-item-other" :text="item.msg">
|
<ChatCardOther
|
||||||
|
class="message-item-other"
|
||||||
|
:text="item.msg"
|
||||||
|
>
|
||||||
<ChatMoreTips
|
<ChatMoreTips
|
||||||
@replySent="handleReply"
|
@replySent="handleReply"
|
||||||
:itemList="mainPageDataModel.guideWords"
|
:itemList="mainPageDataModel.guideWords"
|
||||||
@@ -94,8 +105,12 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<RecommendPostsComponent
|
<RecommendPostsComponent
|
||||||
v-if="mainPageDataModel.recommendTheme.length > 0"
|
v-if="
|
||||||
:recommendThemeList="mainPageDataModel.recommendTheme"
|
mainPageDataModel.recommendTheme.length > 0
|
||||||
|
"
|
||||||
|
:recommendThemeList="
|
||||||
|
mainPageDataModel.recommendTheme
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</ChatCardOther>
|
</ChatCardOther>
|
||||||
</template>
|
</template>
|
||||||
@@ -417,11 +432,11 @@ const handleWebSocketMessage = (data) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const msg = chatMsgList.value[aiMsgIndex].msg;
|
const msg = chatMsgList.value[aiMsgIndex].msg;
|
||||||
console.log('全量消息内容:', msg)
|
console.log("全量消息内容:", msg);
|
||||||
if (!msg || msg === '加载中.' || msg.startsWith('加载中')) {
|
if (!msg || msg === "加载中." || msg.startsWith("加载中")) {
|
||||||
chatMsgList.value[aiMsgIndex].msg = '未获取到内容,请重试';
|
chatMsgList.value[aiMsgIndex].msg = "未获取到内容,请重试";
|
||||||
if (data.toolCall) {
|
if (data.toolCall) {
|
||||||
chatMsgList.value[aiMsgIndex].msg = '';
|
chatMsgList.value[aiMsgIndex].msg = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user