assistant: Show errors without mouse interaction (#16226)
https://github.com/user-attachments/assets/a8e5e0ce-349d-4836-afe6-fc960a307c9f Release Notes: - N/A --------- Co-authored-by: Thorsten <thorsten@zed.dev> Co-authored-by: Danilo <danilo@zed.dev>
This commit is contained in:
parent
f5532afaa7
commit
caf222a71d
2 changed files with 87 additions and 75 deletions
|
@ -285,7 +285,7 @@ impl ContextOperation {
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ContextEvent {
|
||||
AssistError(String),
|
||||
ShowAssistError(SharedString),
|
||||
MessagesEdited,
|
||||
SummaryChanged,
|
||||
WorkflowStepsRemoved(Vec<Range<language::Anchor>>),
|
||||
|
@ -1790,7 +1790,9 @@ impl Context {
|
|||
.map(|error| error.to_string().trim().to_string());
|
||||
|
||||
if let Some(error_message) = error_message.as_ref() {
|
||||
cx.emit(ContextEvent::AssistError(error_message.to_string()));
|
||||
cx.emit(ContextEvent::ShowAssistError(SharedString::from(
|
||||
error_message.clone(),
|
||||
)));
|
||||
}
|
||||
|
||||
this.update_metadata(assistant_message_id, cx, |metadata| {
|
||||
|
@ -1843,7 +1845,9 @@ impl Context {
|
|||
pub fn cancel_last_assist(&mut self, cx: &mut ModelContext<Self>) -> bool {
|
||||
if let Some(pending_completion) = self.pending_completions.pop() {
|
||||
self.update_metadata(pending_completion.assistant_message_id, cx, |metadata| {
|
||||
metadata.status = MessageStatus::Canceled;
|
||||
if metadata.status == MessageStatus::Pending {
|
||||
metadata.status = MessageStatus::Canceled;
|
||||
}
|
||||
});
|
||||
true
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue