Put name on connection as well for Thread Title
This commit is contained in:
parent
44cae51ea3
commit
755cff59a1
4 changed files with 18 additions and 14 deletions
|
@ -572,8 +572,6 @@ impl Error for LoadError {}
|
|||
impl AcpThread {
|
||||
pub fn new(
|
||||
connection: Rc<dyn AgentConnection>,
|
||||
// todo! remove me
|
||||
title: SharedString,
|
||||
project: Entity<Project>,
|
||||
session_id: acp::SessionId,
|
||||
cx: &mut Context<Self>,
|
||||
|
@ -585,7 +583,7 @@ impl AcpThread {
|
|||
shared_buffers: Default::default(),
|
||||
entries: Default::default(),
|
||||
plan: Default::default(),
|
||||
title,
|
||||
title: connection.name().into(),
|
||||
project,
|
||||
send_task: None,
|
||||
connection,
|
||||
|
@ -1783,13 +1781,13 @@ mod tests {
|
|||
}
|
||||
});
|
||||
let connection = OldAcpAgentConnection {
|
||||
name: "test",
|
||||
connection,
|
||||
child_status: io_task,
|
||||
};
|
||||
|
||||
AcpThread::new(
|
||||
Rc::new(connection),
|
||||
"Test".into(),
|
||||
project,
|
||||
acp::SessionId("test".into()),
|
||||
cx,
|
||||
|
|
|
@ -10,6 +10,8 @@ use ui::App;
|
|||
use crate::AcpThread;
|
||||
|
||||
pub trait AgentConnection {
|
||||
fn name(&self) -> &'static str;
|
||||
|
||||
fn new_thread(
|
||||
self: Rc<Self>,
|
||||
project: Entity<Project>,
|
||||
|
@ -35,11 +37,16 @@ impl fmt::Display for Unauthenticated {
|
|||
}
|
||||
|
||||
pub struct OldAcpAgentConnection {
|
||||
pub name: &'static str,
|
||||
pub connection: acp_old::AgentConnection,
|
||||
pub child_status: Task<Result<()>>,
|
||||
}
|
||||
|
||||
impl AgentConnection for OldAcpAgentConnection {
|
||||
fn name(&self) -> &'static str {
|
||||
self.name
|
||||
}
|
||||
|
||||
fn new_thread(
|
||||
self: Rc<Self>,
|
||||
project: Entity<Project>,
|
||||
|
@ -63,7 +70,7 @@ impl AgentConnection for OldAcpAgentConnection {
|
|||
cx.update(|cx| {
|
||||
let thread = cx.new(|cx| {
|
||||
let session_id = acp::SessionId("acp-old-no-id".into());
|
||||
AcpThread::new(self.clone(), "Gemini".into(), project, session_id, cx)
|
||||
AcpThread::new(self.clone(), project, session_id, cx)
|
||||
});
|
||||
thread
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue