bugfix: 切换对话时先清空之前的对话
This commit is contained in:
@@ -80,6 +80,22 @@
|
|||||||
{ deep: true }
|
{ deep: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
messageList.value = []
|
||||||
|
sketchList.value = []
|
||||||
|
params.versionID = ''
|
||||||
|
params.imageUrlList = []
|
||||||
|
params.quotaUrl = []
|
||||||
|
params.needSuggestion = false
|
||||||
|
params.useReport = false
|
||||||
|
params.configParams = {
|
||||||
|
type: '',
|
||||||
|
region: '',
|
||||||
|
style: ''
|
||||||
|
}
|
||||||
|
isGenerating.value = false
|
||||||
|
}
|
||||||
|
|
||||||
// 每次请求时创建新的 AbortController
|
// 每次请求时创建新的 AbortController
|
||||||
let abort: AbortController
|
let abort: AbortController
|
||||||
|
|
||||||
@@ -94,9 +110,11 @@
|
|||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
abort?.abort()
|
abort?.abort()
|
||||||
|
MyEvent.remove('resetAgent', handleReset)
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
MyEvent.add('resetAgent', handleReset)
|
||||||
// 检查 store 中是否有初始项目数据
|
// 检查 store 中是否有初始项目数据
|
||||||
// projectStore.setId('1') // 临时设置项目ID为1,实际应用中应根据上下文动态设置
|
// projectStore.setId('1') // 临时设置项目ID为1,实际应用中应根据上下文动态设置
|
||||||
const initialData = agentStore.getInitialProjectData
|
const initialData = agentStore.getInitialProjectData
|
||||||
|
|||||||
@@ -136,6 +136,7 @@
|
|||||||
if (newVal) {
|
if (newVal) {
|
||||||
handleGetProjectInfoAndHistory()
|
handleGetProjectInfoAndHistory()
|
||||||
MyEvent.emit('projectChange')
|
MyEvent.emit('projectChange')
|
||||||
|
MyEvent.emit('resetAgent')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user