Repository navigation
feat: add conversation-only revert capability #16447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
9addcfc
01d5f3f
9ab1065
200ac28
7c1a1e7
2b3e260
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ export namespace SessionRevert { | |||
| sessionID: Identifier.schema("session"), | ||||
| messageID: Identifier.schema("message"), | ||||
| partID: Identifier.schema("part").optional(), | ||||
| mode: z.enum(["conversation", "conversation_and_code"]).optional(), | ||||
| }) | ||||
| export type RevertInput = z.infer<typeof RevertInput> | ||||
|
|
||||
|
|
@@ -27,6 +28,7 @@ export namespace SessionRevert { | |||
| let lastUser: MessageV2.User | undefined | ||||
| const session = await Session.get(input.sessionID) | ||||
|
|
||||
| const mode = input.mode ?? session.revert?.mode ?? "conversation_and_code" | ||||
| let revert: Session.Info["revert"] | ||||
| const patches: Snapshot.Patch[] = [] | ||||
| for (const msg of all) { | ||||
|
|
@@ -56,6 +58,19 @@ export namespace SessionRevert { | |||
|
|
||||
| if (revert) { | ||||
| const session = await Session.get(input.sessionID) | ||||
|
||||
| const session = await Session.get(input.sessionID) |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we added secondary sorting by
MessageTable.id:Is this strictly necessary or will show up in daily usage? Maybe not, and maybe it was due to the fact that I really shouldn't be doing
Date.now()once in my tests. But I did, and I found this, and maybe this will help in the future?