mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 14:09:00 +08:00
add a config to disable provider config validation (#85)
This commit is contained in:
parent
ac2a1bc954
commit
c6ba67a770
@ -46,6 +46,7 @@ DEFAULTS = {
|
|||||||
'CELERY_BACKEND': 'database',
|
'CELERY_BACKEND': 'database',
|
||||||
'PDF_PREVIEW': 'True',
|
'PDF_PREVIEW': 'True',
|
||||||
'LOG_LEVEL': 'INFO',
|
'LOG_LEVEL': 'INFO',
|
||||||
|
'DISABLE_PROVIDER_CONFIG_VALIDATION': 'False',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,6 +177,9 @@ class Config:
|
|||||||
# hosted provider credentials
|
# hosted provider credentials
|
||||||
self.OPENAI_API_KEY = get_env('OPENAI_API_KEY')
|
self.OPENAI_API_KEY = get_env('OPENAI_API_KEY')
|
||||||
|
|
||||||
|
# By default it is False
|
||||||
|
# You could disable it for compatibility with certain OpenAPI providers
|
||||||
|
self.DISABLE_PROVIDER_CONFIG_VALIDATION = get_bool_env('DISABLE_PROVIDER_CONFIG_VALIDATION')
|
||||||
|
|
||||||
class CloudEditionConfig(Config):
|
class CloudEditionConfig(Config):
|
||||||
|
|
||||||
|
@ -62,6 +62,8 @@ class ProviderService:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validate_provider_configs(tenant, provider_name: ProviderName, configs: Union[dict | str]):
|
def validate_provider_configs(tenant, provider_name: ProviderName, configs: Union[dict | str]):
|
||||||
|
if current_app.config['DISABLE_PROVIDER_CONFIG_VALIDATION']:
|
||||||
|
return
|
||||||
llm_provider_service = LLMProviderService(tenant.id, provider_name.value)
|
llm_provider_service = LLMProviderService(tenant.id, provider_name.value)
|
||||||
return llm_provider_service.config_validate(configs)
|
return llm_provider_service.config_validate(configs)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user