Detailed changes
@@ -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<Self>) -> BoxFuture<'static, Result<()>> {
+ pub fn retry(&mut self, cx: &mut Context<Self>) -> 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
})
}
@@ -64,11 +64,7 @@ pub trait AgentConnection {
cx: &mut App,
) -> Task<Result<acp::PromptResponse>>;
- fn resume(
- &self,
- _session_id: &acp::SessionId,
- _cx: &App,
- ) -> Option<Rc<dyn AgentSessionResume>> {
+ fn retry(&self, _session_id: &acp::SessionId, _cx: &App) -> Option<Rc<dyn AgentSessionRetry>> {
None
}
@@ -135,7 +131,7 @@ pub trait AgentSessionTruncate {
fn run(&self, message_id: UserMessageId, cx: &mut App) -> Task<Result<()>>;
}
-pub trait AgentSessionResume {
+pub trait AgentSessionRetry {
fn run(&self, cx: &mut App) -> Task<Result<acp::PromptResponse>>;
}
@@ -1317,12 +1317,12 @@ impl acp_thread::AgentConnection for NativeAgentConnection {
})
}
- fn resume(
+ fn retry(
&self,
session_id: &acp::SessionId,
_cx: &App,
- ) -> Option<Rc<dyn acp_thread::AgentSessionResume>> {
- Some(Rc::new(NativeAgentSessionResume {
+ ) -> Option<Rc<dyn acp_thread::AgentSessionRetry>> {
+ 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<Result<acp::PromptResponse>> {
self.connection
.run_turn(self.session_id.clone(), cx, |thread, cx| {
@@ -1355,16 +1355,16 @@ impl AcpThreadView {
matches!(self.thread_state, ThreadState::Loading { .. })
}
- fn resume_chat(&mut self, cx: &mut Context<Self>) {
+ fn retry_generation(&mut self, cx: &mut Context<Self>) {
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);
})),
)
})