assistant2: Suggest current thread in inline assistant (#22586)

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.com>
This commit is contained in:
Agus Zubiaga 2025-01-02 17:36:57 -03:00 committed by GitHub
parent 0e75ca8603
commit 374c298bd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 161 additions and 114 deletions

View file

@ -169,25 +169,11 @@ impl PickerDelegate for ThreadContextPickerDelegate {
self.context_store
.update(cx, |context_store, cx| {
let text = thread.update(cx, |thread, _cx| {
let mut text = String::new();
for message in thread.messages() {
text.push_str(match message.role {
language_model::Role::User => "User:",
language_model::Role::Assistant => "Assistant:",
language_model::Role::System => "System:",
});
text.push('\n');
text.push_str(&message.text);
text.push('\n');
}
text
});
context_store.insert_context(ContextKind::Thread, entry.summary.clone(), text);
context_store.insert_context(
ContextKind::Thread(thread.read(cx).id().clone()),
entry.summary.clone(),
thread.read(cx).text(),
);
})
.ok();