Repository navigation
Conversation
Contributor
|
Hello @slorksmo, Can we expand this to have all the needed buttons? Like "Branch to a new chat" and Retry |
Contributor
Author
|
Done. Each finished reply now has Copy, Retry and Branch to a new chat under it, and the code-block copy button is still there. Branch needed a small backend change: the fork endpoint takes an optional |
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.
What
Chat replies get copy, retry and branch actions:
Why
Copying commands from agent replies meant selecting text by hand, and there was no way to retry a reply or continue from an earlier point without losing the rest of the chat. Expanded from the code-block button after review.
Fixes #417
How
useCopyToClipboard(new,state/hooks/shared) holds the copy-and-confirm logic.CopyCodeButtonand the reply actions both use it.turnActions.tsdecides, per assistant block, what the row offers: nothing while the reply streams or for blocks without text, one row per turn (on its last assistant block), the prompt that started the turn, and where a branch cuts the history (the next prompt's timestamp; none for the last turn).runChatRewind. A new optionalresendcallback changes the dialog text and, after the rewind, queues the prompt instead of putting it back in the composer. The prompt queue already waits until the chat is ready, so a retry while the agent is running stops it, rewinds, then sends. The rewind flow itself is unchanged whenresendis not passed.chat.Service.ForkBefore(ctx, id, beforeT);Forknow calls it with zero. A partial fork copies only the events beforebeforeTand starts without provider sessions, the same as after a rewind, because the native session also holds the turns that were left out. The prompt service already sends the visible transcript as context when there is no session.POST /api/chats/{id}/forkaccepts an optional{"beforeT": ...}; an empty body still forks the whole chat, so the sidebar fork is unchanged. Branching from the last reply forks the whole chat and keeps native forks.ForkChatwith a cut-off and Claude's--resume-session-at). Once that lands,ForkBeforecan hand partial forks to it to keep the native session.Testing
npm test: 657 passed. NewturnActions.test.ts(7 tests) and 3 retry cases inchatRewindFlow.test.ts.go test ./internal/service/chat/ ./internal/transport/http/handlers/ ./internal/stores/filechat/on Linux. Newfork_before_test.gocovers the partial copy dropping sessions,beforeT=0matchingFork, and a negative timestamp.npm run buildsucceeds.Ran it on my own instance: copied replies and code blocks, retried the last reply, and branched from a reply in the middle of a chat and continued there.
go test ./...passes (backend and catalog): CInpm testpasses (frontend)gofmt/go vetclean for the changed packagesnpm run buildsucceedsUI changes
npm run dev)