diff --git a/resources/assets/js/components/AIAssistant.vue b/resources/assets/js/components/AIAssistant.vue
index 8f34c7042..18c637682 100644
--- a/resources/assets/js/components/AIAssistant.vue
+++ b/resources/assets/js/components/AIAssistant.vue
@@ -54,7 +54,7 @@
class="ai-assistant-output">
@@ -1054,6 +1054,7 @@ export default {
}
this.currentSessionId = lastSession.id;
this.responses = JSON.parse(JSON.stringify(lastSession.responses));
+ this.syncResponseSeed();
return;
}
}
@@ -1130,6 +1131,22 @@ export default {
}
this.currentSessionId = session.id;
this.responses = JSON.parse(JSON.stringify(session.responses));
+ this.syncResponseSeed();
+ }
+ },
+
+ /**
+ * 同步 responseSeed 以避免与已有响应 localId 冲突
+ */
+ syncResponseSeed() {
+ if (this.responses.length === 0) {
+ return;
+ }
+ const maxLocalId = this.responses.reduce((max, r) => {
+ return Math.max(max, r.localId || 0);
+ }, 0);
+ if (maxLocalId >= this.responseSeed) {
+ this.responseSeed = maxLocalId + 1;
}
},