fix(tui): exclude reverted assistant reply when copying last message (#5705)

Signed-off-by: assagman <ahmetsercansagman@gmail.com>
pull/5339/head
Sercan Sagman 2025-12-18 01:03:06 +03:00 committed by GitHub
parent ca65da2d9e
commit a1b68daa9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -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()