refac: show connection type for custom models

This commit is contained in:
Timothy Jaeryang Baek 2025-12-02 06:19:48 -05:00
parent 954aaa6bdc
commit 39f7575b64

View file

@ -191,6 +191,8 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
): ):
# Custom model based on a base model # Custom model based on a base model
owned_by = "openai" owned_by = "openai"
connection_type = None
pipe = None pipe = None
for m in models: for m in models:
@ -201,6 +203,8 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
owned_by = m.get("owned_by", "unknown") owned_by = m.get("owned_by", "unknown")
if "pipe" in m: if "pipe" in m:
pipe = m["pipe"] pipe = m["pipe"]
connection_type = m.get("connection_type", None)
break break
model = { model = {
@ -209,6 +213,7 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
"object": "model", "object": "model",
"created": custom_model.created_at, "created": custom_model.created_at,
"owned_by": owned_by, "owned_by": owned_by,
"connection_type": connection_type,
"preset": True, "preset": True,
**({"pipe": pipe} if pipe is not None else {}), **({"pipe": pipe} if pipe is not None else {}),
} }