From f8c75eab5bbf08963730829b6a8c6483ae999af6 Mon Sep 17 00:00:00 2001 From: aixianling Date: Fri, 23 Aug 2024 14:40:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=A8=A1=E5=9E=8B=E6=98=AF,?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/packages/ai/AiCopilot.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/packages/ai/AiCopilot.vue b/ui/packages/ai/AiCopilot.vue index 0760c9ed..814364bd 100644 --- a/ui/packages/ai/AiCopilot.vue +++ b/ui/packages/ai/AiCopilot.vue @@ -91,9 +91,8 @@ export default { const {id: fileId, url: sdkFileUrl, name: fileName} = files[0] || {} const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng, fileId, sdkFileUrl, fileName} this.history.push(message) - this.$refs.uploader?.clearFiles() this.loading = true - this.prompt = "" + this.clearCache() this.http.post("/app/appaicopilotinfo/add", message).then(res => { if (res?.data?.length >= 2) { const last = res.data.at(-1) @@ -120,6 +119,7 @@ export default { const {appId, id: aiConfigId, ability} = item this.handleChangeConversation({appId, aiConfigId, ability}) this.history = [{userType: 2, content: `当前应用已切换至【${item.appName}】`}] + this.clearCache() }, handleChangeConversation({conversationId, appId, aiConfigId, ability} = {}) { this.currentConversation = conversationId @@ -135,6 +135,12 @@ export default { const {lat, lng} = v.location this.latlng = [lat, lng].join(",") this.locate = false + }, + clearCache() { + //清理发送消息缓存 + this.prompt = "" + this.files = [] + this.$refs.uploader?.clearFiles() } }, watch: {