Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: The init_azure_openai() method in the core/hosting_configuration.py file doesn't work (#19704) (#19705)

zhaobingshuang303c6ecc1d4a
diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py
index 86887c9b4a4..81d582fb9ae 100644
--- a/api/core/entities/provider_configuration.py
+++ b/api/core/entities/provider_configuration.py
@@ -897,37 +897,36 @@ class ProviderConfiguration(BaseModel):
)
except Exception as ex:
logger.warning(f"get custom model schema failed, {ex}")
-
- if not custom_model_schema:
- continue
-
- if custom_model_schema.model_type not in model_types:
- continue
-
- status = ModelStatus.ACTIVE
- if (
- custom_model_schema.model_type in model_setting_map
- and custom_model_schema.model in model_setting_map[custom_model_schema.model_type]
- ):
- model_setting = model_setting_map[custom_model_schema.model_type][
- custom_model_schema.model
- ]
- if model_setting.enabled is False:
- status = ModelStatus.DISABLED
-
- provider_models.append(
- ModelWithProviderEntity(
- model=custom_model_schema.model,
- label=custom_model_schema.label,
- model_type=custom_model_schema.model_type,
- features=custom_model_schema.features,
- fetch_from=FetchFrom.PREDEFINED_MODEL,
- model_properties=custom_model_schema.model_properties,
- deprecated=custom_model_schema.deprecated,
- provider=SimpleModelProviderEntity(self.provider),
- status=status,
- )
+ continue
+
+ if not custom_model_schema:
+ continue
+
+ if custom_model_schema.model_type not in model_types:
+ continue
+
+ status = ModelStatus.ACTIVE
+ if (
+ custom_model_schema.model_type in model_setting_map
+ and custom_model_schema.model in model_setting_map[custom_model_schema.model_type]
+ ):
+ model_setting = model_setting_map[custom_model_schema.model_type][custom_model_schema.model]
+ if model_setting.enabled is False:
+ status = ModelStatus.DISABLED
+
+ provider_models.append(
+ ModelWithProviderEntity(
+ model=custom_model_schema.model,
+ label=custom_model_schema.label,
+ model_type=custom_model_schema.model_type,
+ features=custom_model_schema.features,
+ fetch_from=FetchFrom.PREDEFINED_MODEL,
+ model_properties=custom_model_schema.model_properties,
+ deprecated=custom_model_schema.deprecated,
+ provider=SimpleModelProviderEntity(self.provider),
+ status=status,
)
+ )
# if llm name not in restricted llm list, remove it
restrict_model_names = [rm.model for rm in restrict_models]