feat: improve model version handling in endpoint selection

Add logic to only append ":latest" suffix to models without existing version suffixes, preventing duplicate version tags and ensuring correct endpoint selection for models following Ollama naming conventions.
This commit is contained in:
Alpha Nerd 2025-12-14 17:58:45 +01:00
parent 3ccaf78e5d
commit 5eb5490d16

View file

@ -687,7 +687,7 @@ async def choose_endpoint(model: str) -> str:
if model in models
]
# 6
# 6
if not candidate_endpoints:
if ":latest" in model: #ollama naming convention not applicable to openai
model_without_latest = model.split(":latest")[0]
@ -696,7 +696,9 @@ async def choose_endpoint(model: str) -> str:
if model_without_latest in models and is_ext_openai_endpoint(ep)
]
if not candidate_endpoints:
model = model + ":latest"
# Only add :latest suffix if model doesn't already have a version suffix
if ":" not in model:
model = model + ":latest"
candidate_endpoints = [
ep for ep, models in zip(config.endpoints, advertised_sets)
if model in models