fix(mm): models lose file extension when syncing

We were stripping the file extension from file models when  moving them in `_sync_model_path`. For example, `some_model.safetensors` would be moved to `some_model`, which of course breaks things.

Instead of using the model's name as the new path, use the model's path's last segment. This is the same behaviour for directories, but for files, it retains the file extension.
This commit is contained in:
psychedelicious 2024-03-10 12:54:51 +11:00
parent eec82afd89
commit 9376b13435

View File

@ -520,7 +520,7 @@ class ModelInstallService(ModelInstallServiceBase):
except ValueError:
pass
new_path = models_dir / model.base.value / model.type.value / model.name
new_path = models_dir / model.base.value / model.type.value / old_path.name
if old_path == new_path:
return model