From ca2b7202e6f3a1e023b00f6af297c620531e5e3b Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 17 May 2024 17:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B0=83=E6=95=B4=E3=80=91AI=20?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E8=B0=83=E6=95=B4=EF=BC=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=8D=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/index.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 9c4c0e95..b91f3ec4 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -35,7 +35,7 @@
- +
@@ -158,7 +158,7 @@ const onPromptInput = (event) => { /** * 发送消息 */ -const onSend = async (val?: string) => { +const onSend = async () => { // 判断用户是否在输入 if (isComposing.value) { return @@ -167,7 +167,11 @@ const onSend = async (val?: string) => { if (conversationInProgress.value) { return } - const content = (val ? val : prompt.value?.trim()) as string + const content = prompt.value?.trim() as string + await doSend(content) +} + +const doSend = async (content: string) => { if (content.length < 2) { ElMessage({ message: '请输入内容!', @@ -176,10 +180,10 @@ const onSend = async (val?: string) => { return } if (activeConversationId.value == null) { - ElMessage({ - message: '还没创建对话,不能发送!', - type: 'error' - }) + ElMessage({ + message: '还没创建对话,不能发送!', + type: 'error' + }) return } // TODO 芋艿:这块交互要在优化;应该是先插入到 UI 界面,里面会有当前的消息,和正在思考中;之后发起请求;