feat: 格式化了对话页的代码
This commit is contained in:
parent
80fc947bbf
commit
49e8332fc0
@ -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>
|
||||
@ -121,7 +136,7 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup >
|
||||
<script setup>
|
||||
import { onMounted, nextTick, onUnmounted, ref, defineEmits } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import {
|
||||
@ -375,7 +390,7 @@ const initWebSocket = () => {
|
||||
|
||||
// 处理WebSocket消息
|
||||
const handleWebSocketMessage = (data) => {
|
||||
if(loadingTimer) {
|
||||
if (loadingTimer) {
|
||||
clearInterval(loadingTimer);
|
||||
loadingTimer = null;
|
||||
}
|
||||
@ -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 = '未获取到内容,请重试';
|
||||
if(data.toolCall) {
|
||||
chatMsgList.value[aiMsgIndex].msg = '';
|
||||
console.log("全量消息内容:", msg);
|
||||
if (!msg || msg === "加载中." || msg.startsWith("加载中")) {
|
||||
chatMsgList.value[aiMsgIndex].msg = "未获取到内容,请重试";
|
||||
if (data.toolCall) {
|
||||
chatMsgList.value[aiMsgIndex].msg = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user