Skip to content

fix(chat): 归档恢复可用且不毁历史,单页渲染与图片解码封顶 - #12

Merged
tall-1997 merged 3 commits into
mainfrom
fix/pr11-followup
Oct 14, 2026
Merged

tall-1997 merged 3 commits into
mainfrom
fix/pr11-followup

Conversation

@tall-1997

Copy link
Copy Markdown
Owner

做了什么

PR11 的后续。三条:

  1. 恢复接上了,而且改成手动。 会话菜单在本地归档里还有已删消息时出现「恢复已删除的消息」,确认后才放回。按 created_at 插回原时间位置,不再追加到末尾。只删掉被恢复的那几条归档,不再清空整个会话的版本历史(旧实现会把还活着的消息的编辑前版本一起清掉)。不自动恢复:重试和主动删除也走归档,静默复活会推翻用户的操作。
  2. 纯图片提问不再连上一轮一起删。 从助手回复往回找锚点时认可见气泡(文字或附件),不再要求正文非空。
  3. 单页渲染和图片解码封顶。 「加载更早」的回退和被切断的整轮补齐共用冷启动的 500 行上限,一次点击不再把更早的全部拉进来。聊天气泡缩略图、全屏预览、输入区图片都走 markdown 渲染器已有的解码尺寸上限——闪退的内存是按单张位图涨的,不是按行数。

测试

  • RestoreOrderTest:恢复行按时间插入,相同时间戳时活消息在前。
  • DeleteAnchorByIdTest:纯图片用户消息成为助手删除的锚点。
  • 本机无 JDK,编译与全量单测交由 CI。

没做的

  • 没有在本地打安装包。
  • 07:31 的前台服务未及时 startForeground 是另一条崩溃,不在这次。

Follow-ups to the session-loss and long-session fixes:

- Restoring archived messages is now a menu action with a count, not dead
  code and not an automatic reload. It slots rows back by created_at
  instead of appending them after everything typed since, and it retires
  only the rows it restored — the session-wide archive wipe was deleting
  the pre-edit history of messages that are still live.
- Deleting from an assistant reply anchors on the visible user bubble,
  including an image-only prompt. Skipping it because its text is empty
  cut the previous turn as well.
- The "load older" fallback and the split-turn prefix share the cold-open
  row cap. One tap no longer materialises every earlier row, and one huge
  tool turn can no longer undo the render window.
- Chat image thumbnails, the fullscreen preview and the composer chip
  decode through the display-size ceiling the markdown renderer already
  uses. The OOM was per-bitmap, not per-row.
aapt merges string resources through a parser that treats a bare ' as a
quote delimiter; the English and French restore body used chat's /
l'archive verbatim and mergeReleaseResources died with an NPE.
restorableCount was declared after the LaunchedEffect that assigns it;
delegated properties must be declared before use.
@tall-1997
tall-1997 merged commit 5040957 into main Oct 14, 2026
1 check passed
@tall-1997
tall-1997 deleted the fix/pr11-followup branch October 14, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant