diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 389b9ca3f8fd97a8372c9855364b9a24007a9126..545f21b922cff308844025aa1f9e5ada82c73728 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -1911,18 +1911,18 @@ impl AcpThread { }) } - pub fn can_resume(&self, cx: &App) -> bool { - self.connection.resume(&self.session_id, cx).is_some() + pub fn can_retry(&self, cx: &App) -> bool { + self.connection.retry(&self.session_id, cx).is_some() } - pub fn resume(&mut self, cx: &mut Context) -> BoxFuture<'static, Result<()>> { + pub fn retry(&mut self, cx: &mut Context) -> BoxFuture<'static, Result<()>> { self.run_turn(cx, async move |this, cx| { this.update(cx, |this, cx| { this.connection - .resume(&this.session_id, cx) - .map(|resume| resume.run(cx)) + .retry(&this.session_id, cx) + .map(|retry| retry.run(cx)) })? - .context("resuming a session is not supported")? + .context("retrying a session is not supported")? .await }) } diff --git a/crates/acp_thread/src/connection.rs b/crates/acp_thread/src/connection.rs index dd29293d8a34146b95bd9e0b7d56684dccfeb2cd..c2d14eacc7fcb2ab2f13166cd3b0b8983f24ba42 100644 --- a/crates/acp_thread/src/connection.rs +++ b/crates/acp_thread/src/connection.rs @@ -64,11 +64,7 @@ pub trait AgentConnection { cx: &mut App, ) -> Task>; - fn resume( - &self, - _session_id: &acp::SessionId, - _cx: &App, - ) -> Option> { + fn retry(&self, _session_id: &acp::SessionId, _cx: &App) -> Option> { None } @@ -135,7 +131,7 @@ pub trait AgentSessionTruncate { fn run(&self, message_id: UserMessageId, cx: &mut App) -> Task>; } -pub trait AgentSessionResume { +pub trait AgentSessionRetry { fn run(&self, cx: &mut App) -> Task>; } diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rs index 3d0f45d1c90b2dc8c6af65f8fe3df59390a5a446..9aa7657f628d3ef033f3ea93fc1dbf8fd5310e44 100644 --- a/crates/agent/src/agent.rs +++ b/crates/agent/src/agent.rs @@ -1317,12 +1317,12 @@ impl acp_thread::AgentConnection for NativeAgentConnection { }) } - fn resume( + fn retry( &self, session_id: &acp::SessionId, _cx: &App, - ) -> Option> { - Some(Rc::new(NativeAgentSessionResume { + ) -> Option> { + Some(Rc::new(NativeAgentSessionRetry { connection: self.clone(), session_id: session_id.clone(), }) as _) @@ -1496,12 +1496,12 @@ impl acp_thread::AgentSessionTruncate for NativeAgentSessionTruncate { } } -struct NativeAgentSessionResume { +struct NativeAgentSessionRetry { connection: NativeAgentConnection, session_id: acp::SessionId, } -impl acp_thread::AgentSessionResume for NativeAgentSessionResume { +impl acp_thread::AgentSessionRetry for NativeAgentSessionRetry { fn run(&self, cx: &mut App) -> Task> { self.connection .run_turn(self.session_id.clone(), cx, |thread, cx| { diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index 4b994b61a8885f7f24708f90da190221adedc958..7c204e9b0c4122306c20161446fccb6ad0e7a66d 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -1355,16 +1355,16 @@ impl AcpThreadView { matches!(self.thread_state, ThreadState::Loading { .. }) } - fn resume_chat(&mut self, cx: &mut Context) { + fn retry_generation(&mut self, cx: &mut Context) { self.thread_error.take(); let Some(thread) = self.thread() else { return; }; - if !thread.read(cx).can_resume(cx) { + if !thread.read(cx).can_retry(cx) { return; } - let task = thread.update(cx, |thread, cx| thread.resume(cx)); + let task = thread.update(cx, |thread, cx| thread.retry(cx)); cx.spawn(async move |this, cx| { let result = task.await; @@ -7943,7 +7943,7 @@ impl AcpThreadView { ) -> Callout { let can_resume = self .thread() - .map_or(false, |thread| thread.read(cx).can_resume(cx)); + .map_or(false, |thread| thread.read(cx).can_retry(cx)); let markdown = if let Some(markdown) = &self.thread_error_markdown { markdown.clone() @@ -7972,7 +7972,7 @@ impl AcpThreadView { .icon_size(IconSize::Small) .tooltip(Tooltip::text("Retry Generation")) .on_click(cx.listener(|this, _, _window, cx| { - this.resume_chat(cx); + this.retry_generation(cx); })), ) })