The dock's provider row opens a list of providers, and the model picker opens on the provider in use, with tab to widen it; signing in opens it on the provider just signed in to. Models go by their id unless config names them, and the model row wears its maker's mark. The guided review's guide prompt is shorter, the pull request brief shows the start of the description with the rest behind p, its commits drop the Luxe-review and Luxe-revision lines, and the weakened-gates signal is gone. luxe update reruns the installer it was installed with, in place of luxe-cli-update. The preview's FILE tab reads files the session changed outside the project, and only those. Smaller fixes: bash headers are highlighted, the preview loses a blank row, the launcher divider sits inside its frame, and the phone app's top bar is clear of iOS's blur. rustls-webpki 0.103.16 and webpki-roots 1.0.10 fix RUSTSEC-2026-0381 and RUSTSEC-2026-0382, and vite 8.3.4 fixes GHSA-587h-7wmj-h5pm, GHSA-698v-4r3x-3vcv and GHSA-r825-w8mm-5pxw.
55 lines
2.0 KiB
Rust
55 lines
2.0 KiB
Rust
//! Provider step — the list of providers the model picker opens on from the dock's provider row.
|
|
//!
|
|
//! Choosing a provider keeps the model in use when that provider serves it too, and otherwise moves
|
|
//! on to that provider's models. [`super::ModelPickerState`] makes that call; this holds the list
|
|
//! and its cursor.
|
|
|
|
use super::ModelEntry;
|
|
use crate::picker::PickerNav;
|
|
|
|
/// One provider row: its id and how many of the catalog's models it serves.
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub(super) struct ProviderRow {
|
|
pub(super) id: String,
|
|
pub(super) models: usize,
|
|
}
|
|
|
|
/// The provider list and its cursor.
|
|
#[derive(Debug, Clone)]
|
|
pub(super) struct ProviderStep {
|
|
pub(super) rows: Vec<ProviderRow>,
|
|
pub(super) nav: PickerNav,
|
|
}
|
|
|
|
impl ProviderStep {
|
|
/// Every provider serving one of `models`, with the cursor on `current` when it is among them.
|
|
pub(super) fn new(models: &[ModelEntry], current: Option<&str>) -> Self {
|
|
let rows = provider_rows(models);
|
|
let mut nav = PickerNav::new(rows.len());
|
|
if let Some(row) = current.and_then(|id| rows.iter().position(|row| row.id == id)) {
|
|
nav.select(row);
|
|
}
|
|
Self { rows, nav }
|
|
}
|
|
|
|
/// The provider under the cursor, if any row matches the query.
|
|
pub(super) fn selected(&self) -> Option<&ProviderRow> {
|
|
self.rows.get(self.nav.selected_item_index()?)
|
|
}
|
|
|
|
/// What a reader can type at a provider row: its id.
|
|
pub(super) fn searchable(&self) -> Vec<String> {
|
|
self.rows.iter().map(|row| row.id.clone()).collect()
|
|
}
|
|
}
|
|
|
|
/// One row per provider, by id. The catalog lists providers in a hash set's order, which means
|
|
/// nothing, so a reader finds one where the alphabet says it is.
|
|
fn provider_rows(models: &[ModelEntry]) -> Vec<ProviderRow> {
|
|
let mut counts = std::collections::BTreeMap::<&str, usize>::new();
|
|
for entry in models {
|
|
*counts.entry(entry.info.r#ref.provider.as_str()).or_default() += 1;
|
|
}
|
|
counts.into_iter().map(|(id, models)| ProviderRow { id: id.to_owned(), models }).collect()
|
|
}
|