bugfix: 切换对话时先清空之前的对话
This commit is contained in:
@@ -80,6 +80,22 @@
|
||||
{ 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
|
||||
let abort: AbortController
|
||||
|
||||
@@ -94,9 +110,11 @@
|
||||
|
||||
onUnmounted(() => {
|
||||
abort?.abort()
|
||||
MyEvent.remove('resetAgent', handleReset)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
MyEvent.add('resetAgent', handleReset)
|
||||
// 检查 store 中是否有初始项目数据
|
||||
// projectStore.setId('1') // 临时设置项目ID为1,实际应用中应根据上下文动态设置
|
||||
const initialData = agentStore.getInitialProjectData
|
||||
|
||||
Reference in New Issue
Block a user