diff --git a/App.vue b/App.vue
index 9737bbc..79015dc 100644
--- a/App.vue
+++ b/App.vue
@@ -7,6 +7,7 @@ export default {
bgMusic: null,
isMusicPlaying: false,
musicSrc: "https://static.ticket.sz-trip.com/epicSoul/EpicSouls.mp3",
+ initMusicSrc:"https://static.ticket.sz-trip.com/epicSoul/EpicSouls.mp3",
// 用户使用统计相关
userSessionId: null,
networkStartTime: null, // 网络时间开始时间
@@ -235,6 +236,7 @@ export default {
console.log("bgMusic", this.globalData.bgMusic);
// 销毁旧的音频实例(关键!)
if (this.globalData.bgMusic) {
+ console.log('销毁bgMusic')
this.globalData.bgMusic.stop();
this.globalData.bgMusic.destroy();
this.globalData.bgMusic = null;
diff --git a/components/Book.vue b/components/Book.vue
index 33cfdee..d0c9ff6 100644
--- a/components/Book.vue
+++ b/components/Book.vue
@@ -10,7 +10,7 @@
@click="handleMoreClick"
>
EPIC SOUL阅读体
- 更多
+
diff --git a/components/DynamicIsland.vue b/components/DynamicIsland.vue
index 0fa0af6..304770f 100644
--- a/components/DynamicIsland.vue
+++ b/components/DynamicIsland.vue
@@ -18,6 +18,11 @@
+ 智能体
@@ -25,9 +30,9 @@
EVITA
- DES介绍 >>
+ DES介绍 >>
- DES广播 >>
+
@@ -363,7 +368,7 @@
// "https://des.js-dyyj.com/dist/#/",
// });
uni.navigateTo({
- url:'/subPackages/other/evita?id=1'
+ url:'/subPackages/other/evita?id=0'
})
},
@@ -599,12 +604,14 @@
position: relative;
margin-right: 10rpx;
width: 140rpx;
- height: 140rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
}
.avatar {
- width: 140rpx;
- height: 140rpx;
+ width: 130rpx;
+ height: 130rpx;
border-radius: 50%;
}
@@ -805,4 +812,24 @@
margin-right: 10rpx;
}
}
+ .ai-label {
+ border: 1rpx solid;
+ padding: 0rpx 15rpx;
+ height: 40rpx;
+ line-height: 38rpx;
+ font-weight: bold;
+ font-size: 20rpx;
+ border-radius: 4rpx;
+ border-color: #333333;
+ color: #333333;
+ display: inline;
+ margin-top: 10rpx;
+ }
+
+ .ai-name {
+ font-size: 27rpx;
+ font-weight: bold;
+ color: #ffffff;
+ margin-left: 10rpx;
+ }
\ No newline at end of file
diff --git a/components/GPT/index.vue b/components/GPT/index.vue
index 102d15f..fe3a513 100644
--- a/components/GPT/index.vue
+++ b/components/GPT/index.vue
@@ -279,6 +279,7 @@ export default {
async audio(n, cb) {
console.log('【audio------>】', n);
+ this.audioArray = this.audioArray.slice(-10)
const txt = this.stripHtmlTags(n.content)
if (!txt) { return }
this.audioCtx && this.audioCtx.destroy()
@@ -290,7 +291,6 @@ export default {
}
const texts = splitTextForTTS(txt)
console.log('语言划分', texts)
-
this.audioActive = n.timestamp
for (let index = 0; index < texts.length; index++) {
const txt = texts[index];
@@ -309,17 +309,15 @@ export default {
return new Promise(async (resolve, reject) => {
if (!this.audioStatus) { reject() }
const url = await this.loadAudioUrl(text)
- console.log('播放文字', text)
+ console.log('开始播放文字', text)
cb && cb(text)
this.audioCtx = wx.createInnerAudioContext();
- this.audioCtx.src = url //'data:audio/wav;base64,' + res.data.data
+ this.audioCtx.src = 'data:audio/wav;base64,' + url
this.audioCtx.play()
this.audioCtx.onStop(() => {
- this.delAudioFile(url)
resolve()
})
this.audioCtx.onEnded(() => {
- this.delAudioFile(url)
resolve()
})
});
@@ -328,6 +326,7 @@ export default {
if (this.audioArray[text]) {
return Promise.resolve(this.audioArray[text])
} else {
+ console.log('-----开始请求语音合成-----', text)
return new Promise((resolve, reject) => {
uni.request({
method: "post",
@@ -336,28 +335,23 @@ export default {
voiceType: this.socketObj.robotObj.voiceType ?? 1002
},
dataType: "json",
- url: `https://des.js-dyyj.com/xcx/api/voice/tts`,
+ url: `https://des.js-dyyj.com/xcx/api/voice/tts/new`,
success: (res) => {
- console.log('文字合成语音', res)
- if (res.data.code) {
- this.audioArray[text] = res.data.msg
- const audio = wx.createInnerAudioContext();
- audio.src = res.data.msg;
- audio.onCanplay(() => {
- audio.destroy(); // 加载后释放资源
- });
-
- resolve(res.data.msg)
-
+ console.log('-----请求语音合成回参-----', res)
+ if (res.data.code == 200) {
+ console.log('-----请求语音合成成功-----', text)
+ this.audioArray[text] = res.data.data.audio
+ resolve(res.data.data.audio)
} else {
+ console.log('-----请求语音合成失败-----', text)
wx.showToast({ title: '文字转化失败' });
reject()
}
},
fail: (err) => {
- console.log("【init msg-------getDemoToken---->】", err);
-
+ console.log("-------请求语音合成失败---->】", err);
+ wx.showToast({ title: '文字转化失败' });
},
});
})
diff --git a/components/GPT/utils/socket.js b/components/GPT/utils/socket.js
index 05b7d79..54d65d7 100644
--- a/components/GPT/utils/socket.js
+++ b/components/GPT/utils/socket.js
@@ -3,7 +3,7 @@ import GLOBAL_OBJ from "./global";
import "./EventHub";
import { setMsgData } from "./message";
// 心跳间隔
-const HEART_BEAT_TIME = 20000;
+const HEART_BEAT_TIME = 15000;
// 心跳最大失败次数(超过此次数重连)
const HEART_BEAT_FAIL_NUM = 1;
// 重连间隔
@@ -18,9 +18,13 @@ export default class Socket {
this.selfCloseStatus = false
this.reconnectLock = false
console.log("Socket init", GLOBAL_OBJ);
+
+ // 失败回答
+ this.failMsg = {}
}
getToken() {
return new Promise((resolve, reject) => {
+ console.log('-----开始请求token-----')
uni.request({
method: "GET",
dataType: "json",
@@ -67,7 +71,7 @@ export default class Socket {
const socket = wx.connectSocket({
url: `${origin}${path}?EIO=4&transport=websocket`,
success: (e) => {
- console.log("创建链接成功", e, socket);
+ console.log("创建长链接成功", e);
},
complete: (e) => {
console.log("socket - complete", e);
@@ -136,7 +140,11 @@ export default class Socket {
}
const num = "" + data.substring(0, 2);
if (num == "40") {
+ console.log("创建对话成功", e);
+ // 发送失败信息
+ this.sendFailMsg()
resolve();
+ // 链接成功
}
this.createInter();
@@ -162,16 +170,14 @@ export default class Socket {
doConnectTimeout() {
// 重连一次
- if (!this.reconnectLock) {
- this.reconnectLock = true;
- this.connectSocketTimeOut = setTimeout(() => {
+ console.log("websocket 异常关闭 开始重连");
+ this.connectSocketTimeOut = setTimeout(() => {
this.createSocket({
complete: function (res) {
- this.reconnectLock = false;
+ // this.reconnectLock = false;
},
});
}, RECONNECT_TIME);
- }
}
onConnect(e) {
@@ -179,10 +185,26 @@ export default class Socket {
}
send(e, t) {
+ console.log("开始请求 websocket send", e);
this.socket && this.socket.send(e);
this.createInter();
}
+ sendFailMsg() {
+ const content = Object.values(this.failMsg)
+ if (content.length) {
+ console.log('开始重新发送失败信息')
+ // 重新发送失败的信息
+ for (let index = 0; index < content.length; index++) {
+ const item = content[index];
+ if (!item.status) {
+ console.log('失败消息', item)
+ // 失败消息 在发送一遍
+ this.send(item.data.socketParams,item.data.contentType )
+ }
+ }
+ }
+ }
getMsgData(e) {
if (e && typeof e == "string") {
const status = e.indexOf("42");
@@ -231,7 +253,13 @@ export default class Socket {
content: params.realContent ? params.realContent : params.content,
};
msgParams && setMsgData(msgParams);
-
+ this.failMsg[params.request_id] = {
+ data: {
+ socketParams,
+ contentType
+ },
+ statue: false
+ }
break;
}
}
@@ -256,6 +284,11 @@ export default class Socket {
}
if (!params.is_from_self && params.is_final) {
+ if (this.failMsg[tmpParams.request_id]) {
+ this.failMsg[tmpParams.request_id].status = true
+ // 已回复 状态为true
+ }
+
// 回复结束 写入缓存
setMsgData(tmpParams);
}
@@ -270,6 +303,7 @@ export default class Socket {
this.socket && this.socket.close();
this.socket = null;
}
+ this.failMsg={}
}
createInter() {
diff --git a/components/ProductSection.vue b/components/ProductSection.vue
index f4e7ac5..5fc85b7 100644
--- a/components/ProductSection.vue
+++ b/components/ProductSection.vue
@@ -4,13 +4,15 @@
{{ title }}
- 更多
+
+
+
-
+
-
+ > -->
+
@@ -74,6 +76,10 @@ export default {
isSearch: {
type: Boolean,
default: true,
+ },
+ isBack: {
+ type: Boolean,
+ default: true,
},
address: {
type: Object,
@@ -130,6 +136,11 @@ export default {
this.initRectInfo();
},
methods: {
+ handleBack(){
+ uni.switchTab({
+ url:'/pages/index/index'
+ })
+ },
initRectInfo() {
const sysInfo = uni.getSystemInfoSync();
this.statusBarHeight = sysInfo.statusBarHeight;
diff --git a/main.js b/main.js
index a92fe40..54a2965 100644
--- a/main.js
+++ b/main.js
@@ -13,7 +13,7 @@ Vue.config.productionTip = false
// 去除生产环境console
if (uni.getSystemInfoSync().platform !== "devtools") {
- console.log = () => {}
+ // console.log = () => {}
}
App.mpType = 'app'
diff --git a/pages.json b/pages.json
index 9513209..a366c4a 100644
--- a/pages.json
+++ b/pages.json
@@ -21,7 +21,8 @@
{
"path": "pages/index/sensoryStore",
"style": {
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "navigationBarTextStyle": "white"
}
},
{
diff --git a/pages/index/iSoul.vue b/pages/index/iSoul.vue
index 13755f8..0a32975 100644
--- a/pages/index/iSoul.vue
+++ b/pages/index/iSoul.vue
@@ -1,5 +1,6 @@
+
-
+