feat: local/external connections

This commit is contained in:
Timothy Jaeryang Baek
2025-05-17 01:47:48 +04:00
parent 000906cd99
commit 08e4c163ea
6 changed files with 74 additions and 33 deletions

View File

@@ -340,6 +340,8 @@ async def get_all_models(request: Request, user: UserModel = None):
), # Legacy support
)
connection_type = api_config.get("connection_type", "local")
prefix_id = api_config.get("prefix_id", None)
tags = api_config.get("tags", [])
model_ids = api_config.get("model_ids", [])
@@ -352,14 +354,16 @@ async def get_all_models(request: Request, user: UserModel = None):
)
)
if prefix_id:
for model in response.get("models", []):
for model in response.get("models", []):
if prefix_id:
model["model"] = f"{prefix_id}.{model['model']}"
if tags:
for model in response.get("models", []):
if tags:
model["tags"] = tags
if connection_type:
model["connection_type"] = connection_type
def merge_models_lists(model_lists):
merged_models = {}