assistant2: Sketch in sending file context to model (#21829)
This PR sketches in support for sending file context attached to a message to the model. Right now the context is just mocked. <img width="1159" alt="Screenshot 2024-12-10 at 4 18 41 PM" src="https://github.com/user-attachments/assets/3ee4e86a-7893-42dc-98f9-982aa202d310"> <img width="1159" alt="Screenshot 2024-12-10 at 4 18 53 PM" src="https://github.com/user-attachments/assets/8a3c2dd7-a466-4dbf-83ec-1c7d969c1a4b"> Release Notes: - N/A
This commit is contained in:
parent
f80eb73213
commit
c255e55599
10 changed files with 145 additions and 15 deletions
|
@ -15,6 +15,7 @@ use ui::prelude::*;
|
|||
use workspace::Workspace;
|
||||
|
||||
use crate::thread::{MessageId, Thread, ThreadError, ThreadEvent};
|
||||
use crate::ui::ContextPill;
|
||||
|
||||
pub struct ActiveThread {
|
||||
workspace: WeakView<Workspace>,
|
||||
|
@ -202,6 +203,8 @@ impl ActiveThread {
|
|||
return Empty.into_any();
|
||||
};
|
||||
|
||||
let context = self.thread.read(cx).context_for_message(message_id);
|
||||
|
||||
let (role_icon, role_name) = match message.role {
|
||||
Role::User => (IconName::Person, "You"),
|
||||
Role::Assistant => (IconName::ZedAssistant, "Assistant"),
|
||||
|
@ -229,7 +232,16 @@ impl ActiveThread {
|
|||
.child(Label::new(role_name).size(LabelSize::Small)),
|
||||
),
|
||||
)
|
||||
.child(v_flex().p_1p5().text_ui(cx).child(markdown.clone())),
|
||||
.child(v_flex().p_1p5().text_ui(cx).child(markdown.clone()))
|
||||
.when_some(context, |parent, context| {
|
||||
parent.child(
|
||||
h_flex().flex_wrap().gap_2().p_1p5().children(
|
||||
context
|
||||
.iter()
|
||||
.map(|context| ContextPill::new(context.clone())),
|
||||
),
|
||||
)
|
||||
}),
|
||||
)
|
||||
.into_any()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue