Skip to content

Commit 052487a

Browse files
authored
fix: 修复Ollama模型中没有已下载的模型时,在 MaxKB 添加 Ollama模型报错。#437 (#453)
1 parent 84a770e commit 052487a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
3535
model_list = OllamaModelProvider.get_base_model_list(model_credential.get('api_base'))
3636
except Exception as e:
3737
raise AppApiException(ValidCode.valid_error.value, "API 域名无效")
38-
exist = [model for model in model_list.get('models') if
38+
exist = [model for model in (model_list.get('models') if model_list.get('models') is not None else []) if
3939
model.get('model') == model_name or model.get('model').replace(":latest", "") == model_name]
4040
if len(exist) == 0:
4141
raise AppApiException(ValidCode.model_not_fount, "模型不存在,请先下载模型")

0 commit comments

Comments
 (0)