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: {