Guard message trace snapshot helper in recall tracking

This commit is contained in:
Youzini-afk
2026-04-05 03:21:58 +08:00
parent d277ce1ee4
commit 6d6c99f6e1

View File

@@ -1210,9 +1210,11 @@ function clearRecallInputTracking() {
pendingRecallSendIntent = createRecallInputRecord();
lastRecallSentUserMessage = createRecallInputRecord();
pendingHostGenerationInputSnapshot = createRecallInputRecord();
recordMessageTraceSnapshot({
lastSentUserMessage: null,
});
if (typeof recordMessageTraceSnapshot === "function") {
recordMessageTraceSnapshot({
lastSentUserMessage: null,
});
}
clearPlannerRecallHandoffsForChat("", { clearAll: true });
}
@@ -1330,15 +1332,17 @@ function recordRecallSentUserMessage(messageId, text, source = "message-sent") {
source,
at: Date.now(),
});
recordMessageTraceSnapshot({
lastSentUserMessage: {
text: normalized,
hash,
messageId: Number.isFinite(messageId) ? messageId : null,
source,
updatedAt: new Date().toISOString(),
},
});
if (typeof recordMessageTraceSnapshot === "function") {
recordMessageTraceSnapshot({
lastSentUserMessage: {
text: normalized,
hash,
messageId: Number.isFinite(messageId) ? messageId : null,
source,
updatedAt: new Date().toISOString(),
},
});
}
// 注意:不再在 MESSAGE_SENT 阶段清空 pendingRecallSendIntent /
// pendingHostGenerationInputSnapshot / transactions。