diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index 6193531..9b53a69 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -147,6 +147,11 @@ async function onConversation() { // 监听WebSocket关闭事件 socket.onclose = (event: any) => { console.log('连接已关闭: ', event) + nowStauts.value = 'input' + } + socket.onerror = (event: any) => { + console.log('连接出错: ', event) + nowStauts.value = 'input' } if (loading.value) @@ -214,7 +219,6 @@ async function onConversation() { lastText += msg.payload.choices.text[0].content mp3.push(msg.payload.choices.mp3) const loading = true - nowStauts.value = 'input' updateChat( +uuid, dataSources.value.length - 1,