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

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
zhaobingshuang 2025-05-15 10:02:59 +08:00 committed by GitHub
parent 85eb55de37
commit 303c6ecc1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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