mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-02 14:30:29 +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",
|
keybind: "messages_copy",
|
||||||
category: "Session",
|
category: "Session",
|
||||||
onSelect: (dialog) => {
|
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) {
|
if (!lastAssistantMessage) {
|
||||||
toast.show({ message: "No assistant messages found", variant: "error" })
|
toast.show({ message: "No assistant messages found", variant: "error" })
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue