Skip to content

Commit 8854269

Browse files
committed
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 <[email protected]>
1 parent 4bf1a71 commit 8854269

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

endpoints/core/utils/model.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ async def get_current_model_list(model_type: str = "model"):
4545
# Make sure the model container exists
4646
match model_type:
4747
case "model":
48-
model_path = model.container.model_dir
48+
if model.container:
49+
model_path = model.container.model_dir
4950
case "draft":
50-
model_path = model.container.draft_model_dir
51+
if model.container:
52+
model_path = model.container.draft_model_dir
5153
case "embedding":
52-
model_path = model.embeddings_container.model_dir
54+
if model.embeddings_container:
55+
model_path = model.embeddings_container.model_dir
5356

5457
if model_path:
5558
current_models.append(ModelCard(id=model_path.name))

0 commit comments

Comments
 (0)