From 9cd15a88944baf8aae5299be7cc38ab63f2174d1 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud <79562285+wangdan-fit2cloud@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:56:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=80=90=E5=BA=94=E7=94=A8=E3=80=91?= =?UTF-8?q?=E9=97=AE=E7=AD=94=E9=A1=B5=E9=9D=A2=E7=94=A8=E6=88=B7=E6=8F=90?= =?UTF-8?q?=E9=97=AE=E6=97=B6=EF=BC=8C=E5=8F=AA=E8=BE=93=E5=85=A5=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E4=B8=8D=E8=83=BD=E5=8F=91=E9=80=81=20(#121)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/ai-chat/index.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index 4ace004bc..b716686b9 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -217,7 +217,7 @@ const chartOpenId = ref('') const chatList = ref([]) const isDisabledChart = computed( - () => !(inputValue.value && (props.appId || (props.data?.name && props.data?.model_id))) + () => !(inputValue.value.trim() && (props.appId || (props.data?.name && props.data?.model_id))) ) const isMdArray = (val: string) => val.match(/^-\s.*/m) const prologueList = computed(() => { @@ -286,7 +286,9 @@ function sendChatHandle(event: any) { // 如果没有按下组合键ctrl,则会阻止默认事件 event.preventDefault() if (!isDisabledChart.value && !loading.value && !event.isComposing) { - chatMessage() + if (inputValue.value.trim()) { + chatMessage() + } } } else { // 如果同时按下ctrl+回车键,则会换行 @@ -423,7 +425,7 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean) { if (!chat) { chat = reactive({ id: randomId(), - problem_text: problem ? problem : inputValue.value, + problem_text: problem ? problem : inputValue.value.trim(), answer_text: '', buffer: [], write_ed: false,