From f42295fe80928bab54c1ac16298e686bb237bdb9 Mon Sep 17 00:00:00 2001 From: Youzini-afk <13153778771cx@gmail.com> Date: Mon, 6 Apr 2026 19:43:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20normal=20=E6=A8=A1=E5=BC=8F=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E8=A7=A3=E6=9E=90=E6=9C=80=E6=96=B0=20user=20?= =?UTF-8?q?=E6=A5=BC=E5=B1=82=E4=BB=A5=E6=8C=81=E4=B9=85=E5=8C=96=20Recall?= =?UTF-8?q?=20Card=EF=BC=9B=E5=85=B3=E9=97=AD=E6=B8=B2=E6=9F=93=E5=90=8E?= =?UTF-8?q?=20MutationObserver=20=E9=A3=8E=E6=9A=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- index.js | 5 +++-- recall-persistence.js | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 589cd5d..44bc789 100644 --- a/index.js +++ b/index.js @@ -2848,8 +2848,9 @@ function schedulePersistedRecallMessageUiRefresh(delayMs = 0) { summary.status === "missing_message_anchor") && attemptIndex < retryDelays.length - 1; - const shouldWatchForRepaint = - summary.status === "rendered" && summary.renderedCount > 0; + // 勿在「已成功渲染」时长期挂 MutationObserver:#chat 上 class/流式更新会疯狂触发 + // runAttempt,造成满屏刷新与日志;显式事件(USER_MESSAGE_RENDERED 等)仍会 schedule 刷新。 + const shouldWatchForRepaint = false; if (!shouldRetryForPending && !shouldWatchForRepaint) { clearPersistedRecallMessageUiObserver(); diff --git a/recall-persistence.js b/recall-persistence.js index 1eaf898..b418474 100644 --- a/recall-persistence.js +++ b/recall-persistence.js @@ -134,11 +134,13 @@ export function resolveGenerationTargetUserMessageIndex( const normalizedType = String(generationType || "normal").trim() || "normal"; + // normal:取「最后一条非系统用户楼层」。若直接 return 末条非 user(常见为刚追加的助手回合), + // 会得到 null,导致持久化无法回绑到本轮 user,`hasRecordForLatest` 长期为 false。 if (normalizedType === "normal") { for (let index = chat.length - 1; index >= 0; index--) { const message = chat[index]; if (message?.is_system) continue; - return message?.is_user ? index : null; + if (message?.is_user) return index; } return null; }