diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py index 2228560a87ff97..a587ec9cf71e1b 100644 --- a/api/core/entities/provider_configuration.py +++ b/api/core/entities/provider_configuration.py @@ -1,5 +1,6 @@ import datetime import json +import logging import time from json import JSONDecodeError from typing import Optional, List, Dict, Tuple, Iterator @@ -18,6 +19,8 @@ from extensions.ext_database import db from models.provider import ProviderType, Provider, ProviderModel, TenantPreferredModelProvider +logger = logging.getLogger(__name__) + class ProviderConfiguration(BaseModel): """ @@ -544,13 +547,17 @@ def _get_custom_provider_models(self, if model_configuration.model_type not in model_types: continue - custom_model_schema = ( - provider_instance.get_model_instance(model_configuration.model_type) - .get_customizable_model_schema_from_credentials( - model_configuration.model, - model_configuration.credentials + try: + custom_model_schema = ( + provider_instance.get_model_instance(model_configuration.model_type) + .get_customizable_model_schema_from_credentials( + model_configuration.model, + model_configuration.credentials + ) ) - ) + except Exception as ex: + logger.warning(f'get custom model schema failed, {ex}') + continue if not custom_model_schema: continue