Repository navigation
feat(chat): edit a question you asked and get a new answer - #59
Merged
Merged
Conversation
POST /chats/{cid}/messages takes `edit`, the id of one of your earlier
questions: it and everything after it are replaced by the edited question
and its new answer. A conversation titled after the edited first question
is retitled; a title you set is kept. In the chat page, each question has
an Edit button (hidden while an answer is being written).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012HJLUkBjcHPCPS9aGhPH2Y
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HJLUkBjcHPCPS9aGhPH2Y
Editing a question keeps the files sent with it; the bubble shows them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HJLUkBjcHPCPS9aGhPH2Y
An edited question keeps the page it was asked from (chat on any page), and a refused edit removes nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HJLUkBjcHPCPS9aGhPH2Y
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: a question in a chat couldn't be changed; the only way to rephrase was to ask again at the end of the conversation.
After: each question you asked has an Edit button (on hover, always visible on touch). Editing it in place and pressing Send replaces that question, its answer and everything after it with the edited question and a fresh answer. The model only sees what came before the edited question. A conversation titled after its first question is retitled when that question is edited; a title you set is kept. Edit is hidden while an answer is being written.
How:
POST /chats/{cid}/messagestakes an optionaledit(the id of one of your questions in that conversation; 404 otherwise).chat.rewinddeletes that message and every later one, then the normal answer path runs. The UI drops those messages from the cached conversation while the new answer streams. OpenAPI and client regenerated withmake openapi.Motivation and Context
Adeel asked for the ability to edit a message in chat.
Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md.Tested: chat API tests on the in-memory engine and against a SurrealDB 3.2.4 server; full frontend jest (542), tsc, eslint, ruff.
🤖 Generated with Claude Code
https://claude.ai/code/session_012HJLUkBjcHPCPS9aGhPH2Y
Generated by Claude Code