assistant: Dismiss model picker upon selection (#27162)

This PR makes the model picker close when you click on a new item.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-03-20 10:22:49 -03:00 committed by GitHub
parent aa2fe9cce1
commit 4421bdd12e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,15 +56,20 @@ impl LanguageModelSelector {
.max_height(Some(rems(20.).into())) .max_height(Some(rems(20.).into()))
}); });
let subscription = cx.subscribe(&picker, |_, _, _, cx| cx.emit(DismissEvent));
LanguageModelSelector { LanguageModelSelector {
picker, picker,
update_matches_task: None, update_matches_task: None,
_authenticate_all_providers_task: Self::authenticate_all_providers(cx), _authenticate_all_providers_task: Self::authenticate_all_providers(cx),
_subscriptions: vec![cx.subscribe_in( _subscriptions: vec![
cx.subscribe_in(
&LanguageModelRegistry::global(cx), &LanguageModelRegistry::global(cx),
window, window,
Self::handle_language_model_registry_event, Self::handle_language_model_registry_event,
)], ),
subscription,
],
} }
} }