Skip to content

Commit

Permalink
fix: 修复Ollama模型中没有已下载的模型时,在 MaxKB 添加 Ollama模型报错。#437 (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed May 15, 2024
1 parent 84a770e commit 052487a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
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, "模型不存在,请先下载模型")
Expand Down

0 comments on commit 052487a

Please sign in to comment.