Skip to content

Commit

Permalink
chore: show guide to registry when model not found
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper committed Dec 16, 2024
1 parent 7dad093 commit 03b801f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/tabby-common/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ impl ModelRegistry {
}

pub fn get_model_info(&self, name: &str) -> &ModelInfo {
self.models
.iter()
.find(|x| x.name == name)
.unwrap_or_else(|| panic!("Invalid model_id <{}/{}>", self.name, name))
match self.models.iter().find(|x| x.name == name) {
Some(model_info) => model_info,
None => panic!(
"Invalid `model_id` <{}/{}>; please consult https://github.com/{}/registry-tabby for the correct `model_id`.",
self.name, name, self.name
),

Check warning on line 171 in crates/tabby-common/src/registry.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-common/src/registry.rs#L166-L171

Added lines #L166 - L171 were not covered by tests
}
}
}

Expand Down

0 comments on commit 03b801f

Please sign in to comment.