From abb5a0887868dab4e1ee961b4cbf146a3f1e9b5e Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 24 Jul 2024 11:16:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=AF=B9=E8=AF=9D=E5=90=8E=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E6=B2=A1=E6=9C=89=E6=B8=85=E7=A9=BA=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E5=AD=97=E6=AE=B5=E5=AD=97=E8=A1=A8=E7=95=99?= =?UTF-8?q?=E7=99=BD=E8=BF=87=E5=A4=9A=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core-frontend/src/views/copilot/index.vue | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/core/core-frontend/src/views/copilot/index.vue b/core/core-frontend/src/views/copilot/index.vue index 6535d1628c..1b572ee930 100644 --- a/core/core-frontend/src/views/copilot/index.vue +++ b/core/core-frontend/src/views/copilot/index.vue @@ -151,20 +151,22 @@ const handleShowLeft = val => { } const copilotChatLoading = ref(false) const inputRef = ref() -let time = null -const queryAnswer = () => { +const queryAnswer = (event?: KeyboardEvent) => { + if (event.keyCode === 13) { + event.preventDefault() + } let copyAuestionInput = questionInput.value if (!isActive.value || copilotChatLoading.value) return - clearTimeout(time) - time = setTimeout(() => { - questionInput.value = copyAuestionInput - inputRef.value.blur() - }, 0) + questionInput.value = '' + inputRef.value.blur() + nextTick(() => { + overHeight.value = false + }) historyArr.value.push({ msgType: 'user', chart: {}, id: `${+new Date()}`, - question: questionInput.value, + question: copyAuestionInput, chartData: { data: {}, title: '' @@ -174,7 +176,7 @@ const queryAnswer = () => { copilotChatLoading.value = true copilotChat({ datasetGroupId: datasetId.value, - question: questionInput.value, + question: copyAuestionInput, history: historyBack }) .then(res => { @@ -185,9 +187,6 @@ const queryAnswer = () => { copilotChatLoading.value = false }) } -onBeforeUnmount(() => { - clearTimeout(time) -})