From d5c65e36c97cba9a1b71423be1b91434bd6f3449 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 20 Nov 2024 06:12:20 -0800 Subject: [PATCH] fix: prefix issue --- backend/open_webui/apps/openai/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/apps/openai/main.py b/backend/open_webui/apps/openai/main.py index 5ba5c774e..42f4388f5 100644 --- a/backend/open_webui/apps/openai/main.py +++ b/backend/open_webui/apps/openai/main.py @@ -313,7 +313,9 @@ async def get_all_models_responses() -> list: prefix_id = api_config.get("prefix_id", None) if prefix_id: - for model in response["data"]: + for model in ( + response if isinstance(response, list) else response.get("data", []) + ): model["id"] = f"{prefix_id}.{model['id']}" log.debug(f"get_all_models:responses() {responses}")