mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix(tui): exclude reverted assistant reply when copying last message (#5705)
Signed-off-by: assagman <ahmetsercansagman@gmail.com>
This commit is contained in:
parent
ca65da2d9e
commit
a1b68daa9a
1 changed files with 4 additions and 1 deletions
|
|
@ -597,7 +597,10 @@ export function Session() {
|
|||
keybind: "messages_copy",
|
||||
category: "Session",
|
||||
onSelect: (dialog) => {
|
||||
const lastAssistantMessage = messages().findLast((msg) => msg.role === "assistant")
|
||||
const revertID = session()?.revert?.messageID
|
||||
const lastAssistantMessage = messages().findLast(
|
||||
(msg) => msg.role === "assistant" && (!revertID || msg.id < revertID),
|
||||
)
|
||||
if (!lastAssistantMessage) {
|
||||
toast.show({ message: "No assistant messages found", variant: "error" })
|
||||
dialog.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue