fix(ui): restrict edit to latest user message (#747)

fix(ui): restrict edit to latest user message (#747)

Only the latest user turn shows the pencil/edit affordance. Older user
messages remain read-only (copy + timestamp still work). Avoids the
misleading implication that historical messages can be lightly edited
when the actual action truncates the session and restarts the
conversation from that point.

Closes #744

Co-authored-by: franksong2702 <franksong2702@users.noreply.github.com>
This commit is contained in:
Frank Song
2026-04-20 14:11:49 +08:00
committed by GitHub
parent da1fdca22c
commit aa78175cca
3 changed files with 23 additions and 1 deletions

9
tests/test_issue744.py Normal file
View File

@@ -0,0 +1,9 @@
import pathlib
def test_only_latest_user_message_gets_edit_button():
src = pathlib.Path("static/ui.js").read_text(encoding="utf-8")
assert "let lastUserRawIdx=-1;" in src
assert "const isEditableUser=isUser&&rawIdx===lastUserRawIdx;" in src
assert "const editBtn = isEditableUser ?" in src