Compare commits

..

No commits in common. "539d9ca5b3349ea602e5d306a282e5f1296d8bae" and "8f2ce34669a93fed2656f117da6a97af6811bc38" have entirely different histories.

4 changed files with 13 additions and 45 deletions

View File

@ -116,8 +116,6 @@
//
let isSessionActive = false;
///
let commonType = ''
//
@ -169,13 +167,8 @@
};
///
const handleReplyInstruct = (item) => {
if(item.type === 'MyOrder') {
///
return
}
commonType = item.type
sendMessage(item.title, true)
const handleReplyInstruct = (text) => {
sendMessage(text, true)
setTimeoutScrollToBottom()
}
@ -278,7 +271,7 @@
conversationId: conversationId.value,
agentId: agentId.value,
messageType: isInstruct ? 1 : 0,
messageContent: isInstruct ? commonType : message
messageContent: message
}
// AI
@ -312,10 +305,9 @@
//
agentChatStream(args, (chunk) => {
console.log('分段内容:', chunk)
if (chunk && chunk.error) {
if (chunk.error) {
chatMsgList.value[aiMsgIndex].msg = '请求错误,请重试';
clearInterval(loadingTimer);
loadingTimer = null;
clearInterval(finishInterval);
isTyping = false;
typeWriterTimer = null;
isSessionActive = false; //
@ -342,20 +334,10 @@
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;
typeWriterTimer = null;
// '.'
const msg = chatMsgList.value[aiMsgIndex].msg;
console.log('msg:', msg)
if (!msg || msg === '加载中.' || msg.startsWith('加载中')) {
chatMsgList.value[aiMsgIndex].msg = '未获取到内容,请重试';
}
isSessionActive = false;
isSessionActive = false; //
scrollToBottom();
}
}, 50);

View File

@ -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)">
<view class="quick-access-item" v-for="(item, index) in itemList" :key="index" @click="sendReply(item.title)">
<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 = (item) => {
emits('replySent', item); //
const sendReply = (text) => {
emits('replySent', text); //
}
onMounted(() => {
@ -33,25 +33,21 @@
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'
}
]
}

View File

@ -4,7 +4,7 @@
<!-- :style="backgroundStyle" -->
<view class="top-item1-left">
<image :src="initPageImages.welcomeImageUrl"></image>
<text>{{ currentDate }} 多云 -36 ff </text>
<text>{{ currentDate }} 多云 -36 gg </text>
</view>
<view class="top-item1-right">
<image :src="initPageImages.logoImageUrl"></image>
@ -23,8 +23,8 @@
type: Object,
default: {
backgroundImageUrl: '',
logoImageUrl: '',
welcomeImageUrl: ''
logoImageUrl: '/static/hello_banner_icon@2x.png',
welcomeImageUrl: '/static/hello_banner_bg@2x.png'
}
},
welcomeContent: {

View File

@ -12,7 +12,6 @@ const API = '/agent/assistant/chat';
function agentChatStream(params, onChunk) {
return new Promise((resolve, reject) => {
const token = uni.getStorageSync('token');
let hasError = false;
console.log("发送请求内容: ", params)
// #ifdef MP-WEIXIN
@ -35,7 +34,7 @@ function agentChatStream(params, onChunk) {
reject(err);
},
complete(res) {
if(res.statusCode !== 200) {
if(res.statusCode === 500) {
console.log("====> ", JSON.stringify(res))
if (onChunk) {
@ -48,18 +47,9 @@ function agentChatStream(params, onChunk) {
requestTask.onHeadersReceived(res => {
console.log('onHeadersReceived', res);
const status = res.statusCode || (res.header && res.header.statusCode);
if (status && status !== 200) {
hasError = true;
if (onChunk) {
onChunk({ error: true, message: `服务器错误(${status})`, detail: res });
}
requestTask.abort && requestTask.abort();
}
});
requestTask.onChunkReceived(res => {
if (hasError) return;
const base64 = uni.arrayBufferToBase64(res.data);
let data = '';
try {