From 08b5e7ef5b4728e380cf6a061ed65e96d4a12c33 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 11 Nov 2024 22:46:47 -0800 Subject: [PATCH] refac: ollama connections --- backend/open_webui/apps/ollama/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/apps/ollama/main.py b/backend/open_webui/apps/ollama/main.py index 9e4a8a451..81b771acb 100644 --- a/backend/open_webui/apps/ollama/main.py +++ b/backend/open_webui/apps/ollama/main.py @@ -263,12 +263,12 @@ def merge_models_lists(model_lists): for idx, model_list in enumerate(model_lists): if model_list is not None: for model in model_list: - digest = model["digest"] - if digest not in merged_models: + id = model["model"] + if id not in merged_models: model["urls"] = [idx] - merged_models[digest] = model + merged_models[id] = model else: - merged_models[digest]["urls"].append(idx) + merged_models[id]["urls"].append(idx) return list(merged_models.values()) @@ -312,6 +312,8 @@ async def get_all_models(): for model in response["models"]: model["model"] = f"{prefix_id}.{model['model']}" + print(responses) + models = { "models": merge_models_lists( map(