Skip to content

feat(chat): edit user messages inline - #707

Closed
Zhangs-11 wants to merge 1 commit into
agegr:mainfrom
Zhangs-11:feat/inline-message-edit
Closed

feat(chat): edit user messages inline#707
Zhangs-11 wants to merge 1 commit into
agegr:mainfrom
Zhangs-11:feat/inline-message-edit

Conversation

@Zhangs-11

@Zhangs-11 Zhangs-11 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a pencil action beside Copy for editing a sent user message in place
  • replace the message bubble with an inline editor containing Cancel and Send actions
  • navigate to the point immediately before the selected message and resend the revised prompt on a new branch of the same session
  • support the first user message, text plus image messages, Escape to cancel, and Ctrl/Cmd+Enter to submit
  • expose editing only while the session is idle, so an active run must be stopped explicitly first

The session JSONL remains append-only. Older branches stay available through the existing branch navigator, while the active chat view shows only the revised message and its new response. No additional sidebar session is created.

This addresses the editing portion of #628.

Implementation notes

  • navigate_tree returns the resulting active leaf so the client can reload the exact parent context before resending
  • the context endpoint distinguishes an omitted leaf from an explicit root position, enabling edits to the first message without leaking pagination state from the previous branch
  • English, Simplified Chinese, and Traditional Chinese labels are included

Testing

  • npm test — 892 tests passed
  • node_modules/.bin/tsc --noEmit
  • npm run lint
  • real browser QA on the rebased commit: editing and resending the first message hides the old active path and returns a fresh model response in the same session

Demo

The demo edits the first active user message and reruns it through the real model flow.

Edit and resend a user message inline

Recorded from Zhangs-11/pi-web@9596cd11e895d44e908fca2d9655f224c10ca93d on the clean rebased branch, served at http://127.0.0.1:30159 with next dev because repository instructions prohibit next build during development. The run used a fresh isolated Pi agent directory, workspace, and headless Chrome profile with the normal application transport; the repository-declared Playwright CDP fallback was used after agent-browser could not connect to its configured CDP endpoint. Real GPT-6-Astra rounds produced both the original and updated answers; no fixtures, mock transport, DOM-event injection, or test-only hooks were used.

@Zhangs-11
Zhangs-11 force-pushed the feat/inline-message-edit branch from 70b6b02 to f6d90e9 Compare September 5, 2026 10:28
Zhangs-11 added a commit to Zhangs-11/pi-web that referenced this pull request Sep 5, 2026
@Zhangs-11
Zhangs-11 force-pushed the feat/inline-message-edit branch from f6d90e9 to 9596cd1 Compare September 5, 2026 10:52
Zhangs-11 added a commit to Zhangs-11/pi-web that referenced this pull request Sep 5, 2026

agegr commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution. The existing "Edit from here" flow already covers editing and resending messages, so we'd prefer to improve that flow (including first-message support) rather than maintain a separate inline editor. Closing this PR for now.

@agegr agegr closed this Sep 5, 2026
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.

2 participants