File tree Expand file tree Collapse file tree 7 files changed +47
-7
lines changed
Expand file tree Collapse file tree 7 files changed +47
-7
lines changed Original file line number Diff line number Diff line change 11"""Backend sync worker service."""
22
3- __version__ = "0.6.28 "
3+ __version__ = "0.6.29 "
Original file line number Diff line number Diff line change 11"""Frontend API and UI service."""
22
3- __version__ = "0.6.28 "
3+ __version__ = "0.6.29 "
Original file line number Diff line number Diff line change @@ -227,9 +227,29 @@ async def get_model_by_provider_and_name(
227227 result = await session .execute (
228228 select (Model )
229229 .where (Model .provider_id == provider_id , Model .model_id == model_id )
230+ .order_by (
231+ Model .is_orphaned .asc (),
232+ Model .last_seen .desc (),
233+ Model .updated_at .desc (),
234+ Model .id .desc (),
235+ )
230236 .options (selectinload (Model .provider ))
231237 )
232- return result .scalar_one_or_none ()
238+ matches = list (result .scalars ().all ())
239+ if not matches :
240+ return None
241+ if len (matches ) > 1 :
242+ import logging
243+
244+ logger = logging .getLogger (__name__ )
245+ logger .warning (
246+ "Duplicate model rows found for provider_id=%s model_id=%s (count=%s); using id=%s" ,
247+ provider_id ,
248+ model_id ,
249+ len (matches ),
250+ matches [0 ].id ,
251+ )
252+ return matches [0 ]
233253
234254
235255async def create_model (
Original file line number Diff line number Diff line change 1- __version__ = "0.6.28 "
1+ __version__ = "0.6.29 "
Original file line number Diff line number Diff line change 11[project ]
22name = " litellm-companion"
3- version = " 0.6.28 "
3+ version = " 0.6.29 "
44description = " Synchronize models from Ollama or OpenAI-compatible endpoints into LiteLLM"
55authors = [
66 {name = " LiteLLM Companion Authors" , email = " dev@example.com" }
Original file line number Diff line number Diff line change 11"""Shared code between backend and frontend services."""
22
3- __version__ = "0.6.28 "
3+ __version__ = "0.6.29 "
Original file line number Diff line number Diff line change @@ -269,9 +269,29 @@ async def get_model_by_provider_and_name(
269269 result = await session .execute (
270270 select (Model )
271271 .where (Model .provider_id == provider_id , Model .model_id == model_id )
272+ .order_by (
273+ Model .is_orphaned .asc (),
274+ Model .last_seen .desc (),
275+ Model .updated_at .desc (),
276+ Model .id .desc (),
277+ )
272278 .options (selectinload (Model .provider ))
273279 )
274- return result .scalar_one_or_none ()
280+ matches = list (result .scalars ().all ())
281+ if not matches :
282+ return None
283+ if len (matches ) > 1 :
284+ import logging
285+
286+ logger = logging .getLogger (__name__ )
287+ logger .warning (
288+ "Duplicate model rows found for provider_id=%s model_id=%s (count=%s); using id=%s" ,
289+ provider_id ,
290+ model_id ,
291+ len (matches ),
292+ matches [0 ].id ,
293+ )
294+ return matches [0 ]
275295
276296
277297async def create_model (
You can’t perform that action at this time.
0 commit comments