Skip to content

Commit

Permalink
chore: show guide to registry when model not found (#3568)
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper authored Dec 16, 2024
1 parent 7dad093 commit f836af0
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
),
}
}
}

Expand Down

0 comments on commit f836af0

Please sign in to comment.