diff --git a/api/configs/app_config.py b/api/configs/app_config.py index b277760edd..c902138595 100644 --- a/api/configs/app_config.py +++ b/api/configs/app_config.py @@ -37,6 +37,7 @@ class DifyConfig( CODE_MAX_NUMBER: int = 9223372036854775807 CODE_MIN_NUMBER: int = -9223372036854775808 + CODE_MAX_DEPTH: int = 5 CODE_MAX_STRING_LENGTH: int = 80000 CODE_MAX_STRING_ARRAY_LENGTH: int = 30 CODE_MAX_OBJECT_ARRAY_LENGTH: int = 30 diff --git a/api/core/workflow/nodes/code/code_node.py b/api/core/workflow/nodes/code/code_node.py index 60678bc2ba..4a010623f9 100644 --- a/api/core/workflow/nodes/code/code_node.py +++ b/api/core/workflow/nodes/code/code_node.py @@ -14,7 +14,7 @@ from models.workflow import WorkflowNodeExecutionStatus MAX_NUMBER = dify_config.CODE_MAX_NUMBER MIN_NUMBER = dify_config.CODE_MIN_NUMBER MAX_PRECISION = 20 -MAX_DEPTH = 5 +MAX_DEPTH = dify_config.CODE_MAX_DEPTH MAX_STRING_LENGTH = dify_config.CODE_MAX_STRING_LENGTH MAX_STRING_ARRAY_LENGTH = dify_config.CODE_MAX_STRING_ARRAY_LENGTH MAX_OBJECT_ARRAY_LENGTH = dify_config.CODE_MAX_OBJECT_ARRAY_LENGTH diff --git a/docker/.env.example b/docker/.env.example index ed9621854a..f530f27a47 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -514,6 +514,7 @@ RESET_PASSWORD_TOKEN_EXPIRY_HOURS=24 CODE_EXECUTION_ENDPOINT=http://sandbox:8194 CODE_MAX_NUMBER=9223372036854775807 CODE_MIN_NUMBER=-9223372036854775808 +CODE_MAX_DEPTH=5 CODE_MAX_STRING_LENGTH=80000 TEMPLATE_TRANSFORM_MAX_LENGTH=80000 CODE_MAX_STRING_ARRAY_LENGTH=30 diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index aea16e3817..b9fa5e6786 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -177,6 +177,7 @@ x-shared-env: &shared-api-worker-env CODE_EXECUTION_API_KEY: ${SANDBOX_API_KEY:-dify-sandbox} CODE_MAX_NUMBER: ${CODE_MAX_NUMBER:-9223372036854775807} CODE_MIN_NUMBER: ${CODE_MIN_NUMBER:--9223372036854775808} + CODE_MAX_DEPTH: ${CODE_MAX_DEPTH:-5} CODE_MAX_STRING_LENGTH: ${CODE_MAX_STRING_LENGTH:-80000} TEMPLATE_TRANSFORM_MAX_LENGTH: ${TEMPLATE_TRANSFORM_MAX_LENGTH:-80000} CODE_MAX_STRING_ARRAY_LENGTH: ${CODE_MAX_STRING_ARRAY_LENGTH:-30}