feat: 来对话列表的处理
This commit is contained in:
@@ -116,6 +116,8 @@
|
||||
|
||||
// 会话进行中标志
|
||||
let isSessionActive = false;
|
||||
/// 指令
|
||||
let commonType = ''
|
||||
|
||||
|
||||
// 打开抽屉
|
||||
@@ -167,8 +169,13 @@
|
||||
};
|
||||
|
||||
/// 是发送指令
|
||||
const handleReplyInstruct = (text) => {
|
||||
sendMessage(text, true)
|
||||
const handleReplyInstruct = (item) => {
|
||||
if(item.type === 'MyOrder') {
|
||||
/// 订单
|
||||
return
|
||||
}
|
||||
commonType = item.type
|
||||
sendMessage(item.title, true)
|
||||
setTimeoutScrollToBottom()
|
||||
}
|
||||
|
||||
@@ -271,7 +278,7 @@
|
||||
conversationId: conversationId.value,
|
||||
agentId: agentId.value,
|
||||
messageType: isInstruct ? 1 : 0,
|
||||
messageContent: message
|
||||
messageContent: isInstruct ? commonType : message
|
||||
}
|
||||
|
||||
// 插入AI消息
|
||||
@@ -305,9 +312,10 @@
|
||||
// 流式接收内容
|
||||
agentChatStream(args, (chunk) => {
|
||||
console.log('分段内容:', chunk)
|
||||
if (chunk.error) {
|
||||
if (chunk && chunk.error) {
|
||||
chatMsgList.value[aiMsgIndex].msg = '请求错误,请重试';
|
||||
clearInterval(finishInterval);
|
||||
clearInterval(loadingTimer);
|
||||
loadingTimer = null;
|
||||
isTyping = false;
|
||||
typeWriterTimer = null;
|
||||
isSessionActive = false; // 出错也允许再次发送
|
||||
@@ -334,10 +342,20 @@
|
||||
if (chunk && chunk.finish) {
|
||||
// 结尾处理:确保剩余内容全部输出
|
||||
const finishInterval = setInterval(() => {
|
||||
console.log('aiMsgBuffer.length:', aiMsgBuffer.length)
|
||||
if (aiMsgBuffer.length === 0) {
|
||||
clearInterval(finishInterval);
|
||||
clearInterval(loadingTimer);
|
||||
loadingTimer = null;
|
||||
isTyping = false;
|
||||
isSessionActive = false; // 会话结束,允许再次发送
|
||||
typeWriterTimer = null;
|
||||
// 补全:如果消息内容还停留在'加载中.'或为空,则给出友好提示
|
||||
const msg = chatMsgList.value[aiMsgIndex].msg;
|
||||
console.log('msg:', msg)
|
||||
if (!msg || msg === '加载中.' || msg.startsWith('加载中')) {
|
||||
chatMsgList.value[aiMsgIndex].msg = '未获取到内容,请重试';
|
||||
}
|
||||
isSessionActive = false;
|
||||
scrollToBottom();
|
||||
}
|
||||
}, 50);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="quick-access">
|
||||
<view class="quick-access-scroll">
|
||||
<view class="quick-access-item" v-for="(item, index) in itemList" :key="index" @click="sendReply(item.title)">
|
||||
<view class="quick-access-item" v-for="(item, index) in itemList" :key="index" @click="sendReply(item)">
|
||||
<image class="quick-access-item-bg" src="/static/quick/quick_icon_bg.png" mode="aspectFill"></image>
|
||||
<view class="quick-access-item-title">
|
||||
<image :src="item.icon"></image>
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
const emits = defineEmits(['replySent']);
|
||||
|
||||
const sendReply = (text) => {
|
||||
emits('replySent', text); // 向父组件传递数据
|
||||
const sendReply = (item) => {
|
||||
emits('replySent', item); // 向父组件传递数据
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -33,21 +33,25 @@
|
||||
icon: '/static/quick/quick_icon_yuding.png',
|
||||
title: '预定门票',
|
||||
content: '快速预定天沐温泉门票',
|
||||
type: 'Command.quickBooking'
|
||||
},
|
||||
{
|
||||
icon: '/static/quick/quick_icon_find.png',
|
||||
title: '探索发现',
|
||||
content: '亲子、团建等更多玩法',
|
||||
type: 'Command.discovery'
|
||||
},
|
||||
{
|
||||
icon: '/static/quick/quick_icon_call.png',
|
||||
title: '呼叫服务',
|
||||
content: '加床、订麻将机...',
|
||||
type: 'Command.createWorkOrder'
|
||||
},
|
||||
{
|
||||
icon: '/static/quick/quick_icon_order.png',
|
||||
title: '我的订单',
|
||||
content: '快速查看订单',
|
||||
type: 'MyOrder'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!-- :style="backgroundStyle" -->
|
||||
<view class="top-item1-left">
|
||||
<image :src="initPageImages.welcomeImageUrl"></image>
|
||||
<text>{{ currentDate }} 多云 -3~6℃ gg </text>
|
||||
<text>{{ currentDate }} 多云 -3~6℃ ff </text>
|
||||
</view>
|
||||
<view class="top-item1-right">
|
||||
<image :src="initPageImages.logoImageUrl"></image>
|
||||
@@ -23,8 +23,8 @@
|
||||
type: Object,
|
||||
default: {
|
||||
backgroundImageUrl: '',
|
||||
logoImageUrl: '/static/hello_banner_icon@2x.png',
|
||||
welcomeImageUrl: '/static/hello_banner_bg@2x.png'
|
||||
logoImageUrl: '',
|
||||
welcomeImageUrl: ''
|
||||
}
|
||||
},
|
||||
welcomeContent: {
|
||||
|
||||
Reference in New Issue
Block a user