feat: 对话缓存机制

This commit is contained in:
2026-04-02 14:50:20 +08:00
parent 59a9046333
commit 04611c60d8
6 changed files with 67 additions and 211 deletions

View File

@@ -4,12 +4,15 @@
<div class="btn" @click="versionTreeData.drawer = true">Version Tree</div>
</div>
<div class="content-wrapper">
<Agent
ref="agentRef"
:title="agentTitle"
@update:sketchList="updateSketchList"
@setTitle="handleSetTitle"
/>
<KeepAlive :max="10">
<Agent
:key="proJectId"
ref="agentRef"
:title="agentTitle"
@update:sketchList="updateSketchList"
@setTitle="handleSetTitle"
/>
</KeepAlive>
<div class="preview-wrapper">
<Preview
ref="previewRef"
@@ -131,31 +134,18 @@
watch(
() => proJectId.value,
async (newVal, oldVal) => {
if (oldVal && agentRef.value && typeof agentRef.value.saveSession === 'function') {
agentRef.value.saveSession(oldVal as string)
}
(newVal, oldVal) => {
projectStore.clearProject()
if (newVal) {
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 {
handleGetProjectInfoAndHistory()
MyEvent.emit('projectChange')
// MyEvent.emit('resetAgent')
}
}
)
onMounted(() => {
console.log('11111agentindex')
MyEvent.add('openReport', handleOpenReport)
MyEvent.add('openUrls', handleOpenUrls)
MyEvent.add('openSketch', handleOpenSketch)