fix(tui): restore reverted prompt optimistically
This commit is contained in:
parent
7157bfb8d5
commit
88cc5cb1bc
1 changed files with 4 additions and 11 deletions
|
|
@ -25,19 +25,12 @@ export function DialogMessage(props: { messageID: string; sessionID: string }) {
|
||||||
title: "Revert",
|
title: "Revert",
|
||||||
value: "session.revert",
|
value: "session.revert",
|
||||||
description: "undo messages and file changes",
|
description: "undo messages and file changes",
|
||||||
onSelect: async (dialog) => {
|
onSelect: (dialog) => {
|
||||||
const error = await sdk.api.session.revert
|
|
||||||
.stage({ sessionID: props.sessionID, messageID: props.messageID })
|
|
||||||
.then(
|
|
||||||
() => undefined,
|
|
||||||
(error) => error,
|
|
||||||
)
|
|
||||||
if (error) {
|
|
||||||
toast.show({ message: errorMessage(error), variant: "error", duration: 5000 })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const value = message()
|
const value = message()
|
||||||
if (value?.type === "user") promptRef.current?.set(revertedPrompt(value))
|
if (value?.type === "user") promptRef.current?.set(revertedPrompt(value))
|
||||||
|
void sdk.api.session.revert
|
||||||
|
.stage({ sessionID: props.sessionID, messageID: props.messageID })
|
||||||
|
.catch((error) => toast.show({ message: errorMessage(error), variant: "error", duration: 5000 }))
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue