diff --git a/pages/chat/ChatInputArea.vue b/pages/chat/ChatInputArea.vue index c59d55c..d111f49 100644 --- a/pages/chat/ChatInputArea.vue +++ b/pages/chat/ChatInputArea.vue @@ -78,8 +78,6 @@ const sendMessage = () => { // 否则发送新消息 if (!inputMessage.value.trim()) return; emit('send', inputMessage.value) - inputMessage.value = '' - emit('update:inputMessage', inputMessage.value) // 发送后保持焦点(可选) if (props.holdKeyboard && textareaRef.value) { diff --git a/pages/chat/ChatMainList.vue b/pages/chat/ChatMainList.vue index df480b2..771487b 100644 --- a/pages/chat/ChatMainList.vue +++ b/pages/chat/ChatMainList.vue @@ -235,9 +235,6 @@ if (!inputText.trim()) return; handleNoHideKeyboard() sendMessage(inputText) - if(!isSessionActive.value) { - inputMessage.value = '' - } // 发送消息后保持键盘状态 if (holdKeyboard.value && inputAreaRef.value) { setTimeout(() => { @@ -343,6 +340,7 @@ } } chatMsgList.value.push(newMsg) + inputMessage.value = ''; sendChat(message, isInstruct) console.log("发送的新消息:",JSON.stringify(newMsg)) } @@ -466,7 +464,7 @@ console.log('请求完成'); }).catch(err => { isSessionActive.value = false; // 出错也允许再次发送 - console.log('error:', err) + console.log('error:', err); }); // 打字机函数