feat: match local model directory to MODEL_SPEC.md (#800)
parent
b8325bd8ab
commit
d41942975d
|
|
@ -58,11 +58,18 @@ impl ModelRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_model_dir(&self, name: &str) -> PathBuf {
|
||||
models_dir().join(&self.name).join(name)
|
||||
}
|
||||
|
||||
pub fn get_model_path(&self, name: &str) -> PathBuf {
|
||||
models_dir()
|
||||
.join(&self.name)
|
||||
.join(name)
|
||||
.join(GGML_MODEL_RELATIVE_PATH)
|
||||
self.get_model_dir(name).join(GGML_MODEL_RELATIVE_PATH)
|
||||
}
|
||||
|
||||
pub fn save_model_info(&self, name: &str) {
|
||||
let model_info = self.get_model_info(name);
|
||||
let path = self.get_model_dir(name).join("tabby.json");
|
||||
serdeconv::to_json_file(model_info, path).unwrap();
|
||||
}
|
||||
|
||||
pub fn get_model_info(&self, name: &str) -> &ModelInfo {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ async fn download_model_impl(
|
|||
prefer_local_file: bool,
|
||||
) -> Result<()> {
|
||||
let model_info = registry.get_model_info(name);
|
||||
registry.save_model_info(name);
|
||||
|
||||
let model_path = registry.get_model_path(name);
|
||||
if model_path.exists() {
|
||||
if !prefer_local_file {
|
||||
|
|
|
|||
Loading…
Reference in New Issue