Allow pressing escape to cancel the current assistant generation (#10987)

If the assistant has already emitted some text, we will leave the
assistant message but maintain the cursor on the previous user message,
so that the user can easily discard the message by submitting again.

If no output was emitted yet, we simply delete the empty assistant
message.

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra
2024-04-25 15:12:58 +02:00
committed by GitHub
parent 0de2636324
commit 530224527d
2 changed files with 31 additions and 4 deletions
+2 -1
View File
@@ -212,7 +212,8 @@
"context": "AssistantChat > Editor", // Used in the assistant2 crate
"bindings": {
"enter": ["assistant2::Submit", "Simple"],
"cmd-enter": ["assistant2::Submit", "Codebase"]
"cmd-enter": ["assistant2::Submit", "Codebase"],
"escape": "assistant2::Cancel"
}
},
{