From 9832e6edba4fd30aff3e30da4c128cfb581f922d Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 28 Apr 2024 10:20:40 -0700 Subject: [PATCH] enhancement: OpenAI API api.together.xyz, api.replicate.com --- backend/apps/openai/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py index d9e378303..b5d1e68d6 100644 --- a/backend/apps/openai/main.py +++ b/backend/apps/openai/main.py @@ -171,6 +171,7 @@ async def fetch_url(url, key): def merge_models_lists(model_lists): + log.info(f"merge_models_lists {model_lists}") merged_list = [] for idx, models in enumerate(model_lists): @@ -199,14 +200,16 @@ async def get_all_models(): ] responses = await asyncio.gather(*tasks) + log.info(f"get_all_models:responses() {responses}") + models = { "data": merge_models_lists( list( map( lambda response: ( response["data"] - if response and "data" in response - else None + if (response and "data" in response) + else (response if isinstance(response, list) else None) ), responses, )