mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 21:42:58 +00:00
refac
This commit is contained in:
parent
816b5977a7
commit
760652c4cc
@ -300,7 +300,7 @@ async def get_all_models():
|
|||||||
prefix_id = api_config.get("prefix_id", None)
|
prefix_id = api_config.get("prefix_id", None)
|
||||||
model_ids = api_config.get("model_ids", [])
|
model_ids = api_config.get("model_ids", [])
|
||||||
|
|
||||||
if len(model_ids) != 0:
|
if len(model_ids) != 0 and "models" in response:
|
||||||
response["models"] = list(
|
response["models"] = list(
|
||||||
filter(
|
filter(
|
||||||
lambda model: model["model"] in model_ids,
|
lambda model: model["model"] in model_ids,
|
||||||
@ -309,7 +309,7 @@ async def get_all_models():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if prefix_id:
|
if prefix_id:
|
||||||
for model in response["models"]:
|
for model in response.get("models", []):
|
||||||
model["model"] = f"{prefix_id}.{model['model']}"
|
model["model"] = f"{prefix_id}.{model['model']}"
|
||||||
|
|
||||||
print(responses)
|
print(responses)
|
||||||
@ -317,7 +317,8 @@ async def get_all_models():
|
|||||||
models = {
|
models = {
|
||||||
"models": merge_models_lists(
|
"models": merge_models_lists(
|
||||||
map(
|
map(
|
||||||
lambda response: response["models"] if response else None, responses
|
lambda response: response.get("models", []) if response else None,
|
||||||
|
responses,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user