diff --git a/api/db/services/llm_service.py b/api/db/services/llm_service.py index e124b5b16..462eb9d4a 100644 --- a/api/db/services/llm_service.py +++ b/api/db/services/llm_service.py @@ -45,6 +45,18 @@ class TenantLLMService(CommonService): objs = cls.query(tenant_id=tenant_id, llm_name=mdlnm) else: objs = cls.query(tenant_id=tenant_id, llm_name=mdlnm, llm_factory=fid) + + if (not objs) and fid: + if fid == "LocalAI": + mdlnm += "___LocalAI" + elif fid == "HuggingFace": + mdlnm += "___HuggingFace" + elif fid == "OpenAI-API-Compatible": + mdlnm += "___OpenAI-API" + elif fid == "VLLM": + mdlnm += "___VLLM" + + objs = cls.query(tenant_id=tenant_id, llm_name=mdlnm, llm_factory=fid) if not objs: return return objs[0]