mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 18:36:04 +08:00
Fix 500 error when creating from the template and the provider is None (#2591)
This commit is contained in:
parent
f1cbd55007
commit
582ba45c00
@ -124,19 +124,13 @@ class AppListApi(Resource):
|
|||||||
available_models_names = [f'{model.provider.provider}.{model.model}' for model in available_models]
|
available_models_names = [f'{model.provider.provider}.{model.model}' for model in available_models]
|
||||||
provider_model = f"{model_config_dict['model']['provider']}.{model_config_dict['model']['name']}"
|
provider_model = f"{model_config_dict['model']['provider']}.{model_config_dict['model']['name']}"
|
||||||
if provider_model not in available_models_names:
|
if provider_model not in available_models_names:
|
||||||
model_manager = ModelManager()
|
if not default_model_entity:
|
||||||
model_instance = model_manager.get_default_model_instance(
|
|
||||||
tenant_id=current_user.current_tenant_id,
|
|
||||||
model_type=ModelType.LLM
|
|
||||||
)
|
|
||||||
|
|
||||||
if not model_instance:
|
|
||||||
raise ProviderNotInitializeError(
|
raise ProviderNotInitializeError(
|
||||||
"No Default System Reasoning Model available. Please configure "
|
"No Default System Reasoning Model available. Please configure "
|
||||||
"in the Settings -> Model Provider.")
|
"in the Settings -> Model Provider.")
|
||||||
else:
|
else:
|
||||||
model_config_dict["model"]["provider"] = model_instance.provider
|
model_config_dict["model"]["provider"] = default_model_entity.provider
|
||||||
model_config_dict["model"]["name"] = model_instance.model
|
model_config_dict["model"]["name"] = default_model_entity.model
|
||||||
|
|
||||||
model_configuration = AppModelConfigService.validate_configuration(
|
model_configuration = AppModelConfigService.validate_configuration(
|
||||||
tenant_id=current_user.current_tenant_id,
|
tenant_id=current_user.current_tenant_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user