From 1f5e9f1a4980464183b27128bd9643dacb0b5e1e Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Fri, 24 Apr 2026 09:19:22 +0800 Subject: [PATCH] =?UTF-8?q?Refactor(=E4=BA=91=E7=81=B5AI):ws=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5key=E8=B0=83=E6=95=B4=E4=B8=BAunionId=20+=20"-"=20+=20?= =?UTF-8?q?conversationId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aiChat/mixins/chatMixinsV2.js | 2 +- aiChat/views/index.vue | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/aiChat/mixins/chatMixinsV2.js b/aiChat/mixins/chatMixinsV2.js index 8090cfa..aad31c9 100644 --- a/aiChat/mixins/chatMixinsV2.js +++ b/aiChat/mixins/chatMixinsV2.js @@ -290,7 +290,7 @@ export const chatMixinsV2 = { const _this = this console.log('------------------创建连接') 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: { 'content-type': 'application/json' }, diff --git a/aiChat/views/index.vue b/aiChat/views/index.vue index 403aa2e..5a3df6a 100644 --- a/aiChat/views/index.vue +++ b/aiChat/views/index.vue @@ -607,7 +607,18 @@ export default { getAiSystemInfoTopic().then(res => { const { success, data } = res 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) } }) },