feat: 用缓存处理对话中的项目切换问题
This commit is contained in:
@@ -131,12 +131,26 @@
|
||||
|
||||
watch(
|
||||
() => proJectId.value,
|
||||
(newVal, oldVal) => {
|
||||
async (newVal, oldVal) => {
|
||||
if (oldVal && agentRef.value && typeof agentRef.value.saveSession === 'function') {
|
||||
agentRef.value.saveSession(oldVal as string)
|
||||
}
|
||||
|
||||
projectStore.clearProject()
|
||||
|
||||
if (newVal) {
|
||||
handleGetProjectInfoAndHistory()
|
||||
let restored = false
|
||||
if (agentRef.value && typeof agentRef.value.restoreSession === 'function') {
|
||||
restored = await agentRef.value.restoreSession(newVal as string)
|
||||
}
|
||||
|
||||
if (!restored) {
|
||||
handleGetProjectInfoAndHistory()
|
||||
}
|
||||
|
||||
MyEvent.emit('projectChange')
|
||||
} else {
|
||||
MyEvent.emit('projectChange')
|
||||
MyEvent.emit('resetAgent')
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user