@@ -232,6 +232,13 @@ impl AgentModelList {
AgentModelList::Grouped(groups) => groups.is_empty(),
}
}
+
+ pub fn len(&self) -> usize {
+ match self {
+ AgentModelList::Flat(models) => models.len(),
+ AgentModelList::Grouped(groups) => groups.values().len(),
+ }
+ }
}
#[cfg(feature = "test-support")]
@@ -71,7 +71,7 @@ impl AcpModelPickerDelegate {
let (models, selected_model) = futures::join!(models_task, selected_model_task);
this.update_in(cx, |this, window, cx| {
- this.delegate.models = models.ok();
+ this.delegate.models = models.log_err();
this.delegate.selected_model = selected_model.ok();
this.delegate.update_matches(this.query(cx), window, cx)
})?
@@ -144,6 +144,11 @@ impl PickerDelegate for AcpModelPickerDelegate {
cx.spawn_in(window, async move |this, cx| {
let filtered_models = match this
.read_with(cx, |this, cx| {
+ if let Some(models) = this.delegate.models.as_ref() {
+ log::debug!("Filtering {} models.", models.len());
+ } else {
+ log::debug!("No models available.");
+ }
this.delegate.models.clone().map(move |models| {
fuzzy_search(models, query, cx.background_executor().clone())
})
@@ -155,6 +160,8 @@ impl PickerDelegate for AcpModelPickerDelegate {
None => AgentModelList::Flat(vec![]),
};
+ log::debug!("Filtered models. {} available.", filtered_models.len());
+
this.update_in(cx, |this, window, cx| {
this.delegate.filtered_entries =
info_list_to_picker_entries(filtered_models).collect();