From b0cefb05e005c445c67f528955cf81c313fb3cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Tue, 12 Dec 2023 19:45:21 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96chat=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development.example | 1 + .../Apps/ChatAi/components/ChitChat/index.vue | 14 ++++---------- .../Apps/ChatAi/components/Sidebar/index.vue | 18 +++++++++++++++--- src/components/Apps/ChatAi/index.vue | 2 +- src/components/Apps/DrawerPanel/index.vue | 3 +++ src/i18n/langs/en.json | 1 + src/i18n/langs/ja.json | 1 + src/i18n/langs/zh.json | 1 + vue.config.js | 5 +++++ 9 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.env.development.example b/.env.development.example index b7ca77488..6ab370024 100644 --- a/.env.development.example +++ b/.env.development.example @@ -22,5 +22,6 @@ VUE_APP_LOGOUT_PATH = '/core/auth/logout/' # Dev server for core proxy VUE_APP_CORE_HOST = 'http://localhost:8080' VUE_APP_CORE_WS = 'ws://localhost:8080' +VUE_APP_KAEL_HOST = 'http://localhost:8083' VUE_APP_KAEL_WS = 'ws://localhost:8083' VUE_APP_ENV = 'development' diff --git a/src/components/Apps/ChatAi/components/ChitChat/index.vue b/src/components/Apps/ChatAi/components/ChitChat/index.vue index c8d856eb0..7a57685be 100644 --- a/src/components/Apps/ChatAi/components/ChitChat/index.vue +++ b/src/components/Apps/ChatAi/components/ChitChat/index.vue @@ -90,9 +90,10 @@ export default { }, methods: { initWebSocket() { + const api = '/kael/chat/system/' const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws' - const path = `${protocol}://${window.location.host}/kael/chat/system/` - const localPath = process.env.VUE_APP_KAEL_WS + '/kael/chat/system/' + const path = `${protocol}://${window.location.host}${api}` + const localPath = process.env.VUE_APP_KAEL_WS + api const url = process.env.NODE_ENV === 'development' ? localPath : path createWebSocket(url, this.onWebSocketMessage) }, @@ -174,15 +175,8 @@ export default { } }, onStopHandle() { - const { protocol, host } = window.location - const { NODE_ENV, VUE_APP_KAEL_WS } = process.env || {} - const api = '/kael/chat/system/interrupt_current_ask/' - const path = `${protocol}://${host}` - const index = VUE_APP_KAEL_WS.indexOf('//') - const localPath = protocol + VUE_APP_KAEL_WS.substring(index, VUE_APP_KAEL_WS.length) + api - const url = NODE_ENV === 'development' ? localPath : path this.$axios.post( - url, + '/kael/chat/system/interrupt_current_ask/', { id: this.currentConversationId || '' } ).finally(() => { removeLoadingMessageInChat() diff --git a/src/components/Apps/ChatAi/components/Sidebar/index.vue b/src/components/Apps/ChatAi/components/Sidebar/index.vue index 063be26d1..5a8d5ba4e 100644 --- a/src/components/Apps/ChatAi/components/Sidebar/index.vue +++ b/src/components/Apps/ChatAi/components/Sidebar/index.vue @@ -1,12 +1,16 @@