Refactor(云灵AI):ws连接key调整为unionId + "-" + conversationId
This commit is contained in:
@@ -290,7 +290,7 @@ export const chatMixinsV2 = {
|
|||||||
const _this = this
|
const _this = this
|
||||||
console.log('------------------创建连接')
|
console.log('------------------创建连接')
|
||||||
uni.connectSocket({
|
uni.connectSocket({
|
||||||
url: VUE_APP_API_URL.replace('https', 'wss') + settings.sysPrefix + `v1/chat/websocket/${_this.userInfo.unionId}`,
|
url: VUE_APP_API_URL.replace('https', 'wss') + settings.sysPrefix + `v1/chat/websocket/${_this.userInfo.unionId}-${conversationId}`,
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
},
|
},
|
||||||
|
|||||||
+12
-1
@@ -607,7 +607,18 @@ export default {
|
|||||||
getAiSystemInfoTopic().then(res => {
|
getAiSystemInfoTopic().then(res => {
|
||||||
const { success, data } = res
|
const { success, data } = res
|
||||||
if (success) {
|
if (success) {
|
||||||
this.topicList = (data || []).slice(0, 3)
|
// 返回数据先过滤this.topicList,随机保留三条数据
|
||||||
|
let list = data || []
|
||||||
|
if (this.topicList && this.topicList.length > 0) {
|
||||||
|
const currentTitles = this.topicList.map(item => item.title)
|
||||||
|
const filtered = list.filter(item => !currentTitles.includes(item.title))
|
||||||
|
// 如果过滤后的数据不够3条,就不进行过滤
|
||||||
|
if (filtered.length >= 3) {
|
||||||
|
list = filtered
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.sort(() => Math.random() - 0.5)
|
||||||
|
this.topicList = list.slice(0, 3)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user