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.

feat: add Maximum number of Parallelism branches to env (#15964)

XiaoBa5e52d4d6b3e8
diff --git a/docker/.env.example b/docker/.env.example
index c7b77d4c565..b295f5cdf08 100644
--- a/docker/.env.example
+++ b/docker/.env.example
@@ -738,6 +738,9 @@ LOOP_NODE_MAX_COUNT=100
# The maximum number of tools that can be used in the agent.
MAX_TOOLS_NUM=10
+# Maximum number of Parallelism branches in the workflow
+MAX_PARALLEL_LIMIT=10
+
# ------------------------------
# Environment Variables for web Service
# ------------------------------
diff --git a/docker/docker-compose-template.yaml b/docker/docker-compose-template.yaml
index 29753be565d..f16dcf048ce 100644
--- a/docker/docker-compose-template.yaml
+++ b/docker/docker-compose-template.yaml
@@ -69,6 +69,7 @@ services:
PM2_INSTANCES: ${PM2_INSTANCES:-2}
LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100}
MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10}
+ MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10}
# The postgres database.
db:
diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml
index 308621d1d29..a0b144cc04d 100644
--- a/docker/docker-compose.yaml
+++ b/docker/docker-compose.yaml
@@ -322,6 +322,7 @@ x-shared-env: &shared-api-worker-env
SSRF_PROXY_HTTPS_URL: ${SSRF_PROXY_HTTPS_URL:-http://ssrf_proxy:3128}
LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100}
MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10}
+ MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10}
TEXT_GENERATION_TIMEOUT_MS: ${TEXT_GENERATION_TIMEOUT_MS:-60000}
PGUSER: ${PGUSER:-${DB_USERNAME}}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-${DB_PASSWORD}}
@@ -498,6 +499,7 @@ services:
PM2_INSTANCES: ${PM2_INSTANCES:-2}
LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100}
MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10}
+ MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10}
# The postgres database.
db:
diff --git a/web/.env.example b/web/.env.example
index fa1477ba796..6b2ab154cfd 100644
--- a/web/.env.example
+++ b/web/.env.example
@@ -42,4 +42,7 @@ NEXT_PUBLIC_INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=4000
NEXT_PUBLIC_LOOP_NODE_MAX_COUNT=100
# Maximum number of tools in the agent/workflow
-NEXT_PUBLIC_MAX_TOOLS_NUM=10
\ No newline at end of file
+NEXT_PUBLIC_MAX_TOOLS_NUM=10
+
+# Maximum number of Parallelism branches in the workflow
+NEXT_PUBLIC_MAX_PARALLEL_LIMIT=10
\ No newline at end of file
diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts
index 79dd541b70f..63f45b82b28 100644
--- a/web/app/components/workflow/constants.ts
+++ b/web/app/components/workflow/constants.ts
@@ -416,7 +416,14 @@ export const LOOP_PADDING = {
left: 16,
}
-export const PARALLEL_LIMIT = 10
+let maxParallelLimit = 10
+
+if (process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT && process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT !== '')
+ maxParallelLimit = Number.parseInt(process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT)
+else if (globalThis.document?.body?.getAttribute('data-public-max-parallel-limit') && globalThis.document.body.getAttribute('data-public-max-parallel-limit') !== '')
+ maxParallelLimit = Number.parseInt(globalThis.document.body.getAttribute('data-public-max-parallel-limit') as string)
+
+export const PARALLEL_LIMIT = maxParallelLimit
export const PARALLEL_DEPTH_LIMIT = 3
export const RETRIEVAL_OUTPUT_STRUCT = `{
diff --git a/web/app/layout.tsx b/web/app/layout.tsx
index 8a5af7acfc7..d5d39c743cc 100644
--- a/web/app/layout.tsx
+++ b/web/app/layout.tsx
@@ -48,6 +48,7 @@ const LocaleLayout = ({
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
data-public-text-generation-timeout-ms={process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS}
data-public-max-tools-num={process.env.NEXT_PUBLIC_MAX_TOOLS_NUM}
+ data-public-max-parallel-limit={process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT}
data-public-top-k-max-value={process.env.NEXT_PUBLIC_TOP_K_MAX_VALUE}
data-public-indexing-max-segmentation-tokens-length={process.env.NEXT_PUBLIC_INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH}
data-public-loop-node-max-count={process.env.NEXT_PUBLIC_LOOP_NODE_MAX_COUNT}