切换模型是,清理发送消息的缓存

This commit is contained in:
aixianling
2024-08-23 14:40:54 +08:00
parent d5b1190492
commit f8c75eab5b

View File

@@ -91,9 +91,8 @@ export default {
const {id: fileId, url: sdkFileUrl, name: fileName} = files[0] || {} const {id: fileId, url: sdkFileUrl, name: fileName} = files[0] || {}
const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng, fileId, sdkFileUrl, fileName} const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng, fileId, sdkFileUrl, fileName}
this.history.push(message) this.history.push(message)
this.$refs.uploader?.clearFiles()
this.loading = true this.loading = true
this.prompt = "" this.clearCache()
this.http.post("/app/appaicopilotinfo/add", message).then(res => { this.http.post("/app/appaicopilotinfo/add", message).then(res => {
if (res?.data?.length >= 2) { if (res?.data?.length >= 2) {
const last = res.data.at(-1) const last = res.data.at(-1)
@@ -120,6 +119,7 @@ export default {
const {appId, id: aiConfigId, ability} = item const {appId, id: aiConfigId, ability} = item
this.handleChangeConversation({appId, aiConfigId, ability}) this.handleChangeConversation({appId, aiConfigId, ability})
this.history = [{userType: 2, content: `当前应用已切换至【${item.appName}`}] this.history = [{userType: 2, content: `当前应用已切换至【${item.appName}`}]
this.clearCache()
}, },
handleChangeConversation({conversationId, appId, aiConfigId, ability} = {}) { handleChangeConversation({conversationId, appId, aiConfigId, ability} = {}) {
this.currentConversation = conversationId this.currentConversation = conversationId
@@ -135,6 +135,12 @@ export default {
const {lat, lng} = v.location const {lat, lng} = v.location
this.latlng = [lat, lng].join(",") this.latlng = [lat, lng].join(",")
this.locate = false this.locate = false
},
clearCache() {
//清理发送消息缓存
this.prompt = ""
this.files = []
this.$refs.uploader?.clearFiles()
} }
}, },
watch: { watch: {