API: Fix current model list return

Check if the container actually exists in the match before returning
the value of the directory.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-09-01 10:54:01 -04:00
parent 4bf1a71d7b
commit 8854269121

View file

@ -45,11 +45,14 @@ async def get_current_model_list(model_type: str = "model"):
# Make sure the model container exists
match model_type:
case "model":
model_path = model.container.model_dir
if model.container:
model_path = model.container.model_dir
case "draft":
model_path = model.container.draft_model_dir
if model.container:
model_path = model.container.draft_model_dir
case "embedding":
model_path = model.embeddings_container.model_dir
if model.embeddings_container:
model_path = model.embeddings_container.model_dir
if model_path:
current_models.append(ModelCard(id=model_path.name))