From 052487a22d70a1b9ffe3561713dd2660878f6459 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Wed, 15 May 2024 11:03:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DOllama=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=B8=AD=E6=B2=A1=E6=9C=89=E5=B7=B2=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9E=8B=E6=97=B6=EF=BC=8C=E5=9C=A8=20MaxKB?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=20Ollama=E6=A8=A1=E5=9E=8B=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E3=80=82#437=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ollama_model_provider/ollama_model_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py b/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py index 3827bdc68..73239921e 100644 --- a/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py +++ b/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py @@ -35,7 +35,7 @@ class OllamaLLMModelCredential(BaseForm, BaseModelCredential): model_list = OllamaModelProvider.get_base_model_list(model_credential.get('api_base')) except Exception as e: raise AppApiException(ValidCode.valid_error.value, "API 域名无效") - exist = [model for model in model_list.get('models') if + exist = [model for model in (model_list.get('models') if model_list.get('models') is not None else []) if model.get('model') == model_name or model.get('model').replace(":latest", "") == model_name] if len(exist) == 0: raise AppApiException(ValidCode.model_not_fount, "模型不存在,请先下载模型")