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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: allow users to specify timeout for text generations and workflows by environment variable (#8395)
kurokobo52857dc0a60d
diff --git a/docker/.env.example b/docker/.env.exampleindex 7e4430a37da..c892c15636e 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -568,6 +568,13 @@ SSRF_PROXY_HTTP_URL=http://ssrf_proxy:3128# SSRF Proxy server HTTPS URLSSRF_PROXY_HTTPS_URL=http://ssrf_proxy:3128+# ------------------------------+# Environment Variables for web Service+# ------------------------------++# The timeout for the text generation in millisecond+TEXT_GENERATION_TIMEOUT_MS=60000+# ------------------------------# Environment Variables for db Service# ------------------------------diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yamlindex 10bd1d1ae27..0fbc6951776 100644--- a/docker/docker-compose.yaml+++ b/docker/docker-compose.yaml@@ -254,6 +254,7 @@ services:APP_API_URL: ${APP_API_URL:-}SENTRY_DSN: ${WEB_SENTRY_DSN:-}NEXT_TELEMETRY_DISABLED: ${NEXT_TELEMETRY_DISABLED:-0}+ TEXT_GENERATION_TIMEOUT_MS: ${TEXT_GENERATION_TIMEOUT_MS:-60000}# The postgres database.db:diff --git a/web/.env.example b/web/.env.exampleindex 3045cef2f9d..8e254082b38 100644--- a/web/.env.example+++ b/web/.env.example@@ -19,3 +19,6 @@ NEXT_TELEMETRY_DISABLED=1# Disable Upload Image as WebApp icon default is falseNEXT_PUBLIC_UPLOAD_IMAGE_AS_ICON=false++# The timeout for the text generation in millisecond+NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS=60000diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsxindex 2d5546f9b4f..a61302fc988 100644--- a/web/app/components/share/text-generation/result/index.tsx+++ b/web/app/components/share/text-generation/result/index.tsx@@ -269,8 +269,10 @@ const Result: FC<IResultProps> = ({}))},onWorkflowFinished: ({ data }) => {- if (isTimeout)+ if (isTimeout) {+ notify({ type: 'warning', message: t('appDebug.warningMessage.timeoutExceeded') })return+ }if (data.error) {notify({ type: 'error', message: data.error })setWorkflowProcessData(produce(getWorkflowProcessData()!, (draft) => {@@ -326,8 +328,10 @@ const Result: FC<IResultProps> = ({setCompletionRes(res.join(''))},onCompleted: () => {- if (isTimeout)+ if (isTimeout) {+ notify({ type: 'warning', message: t('appDebug.warningMessage.timeoutExceeded') })return+ }setRespondingFalse()setMessageId(tempMessageId)onCompleted(getCompletionRes(), taskId, true)@@ -338,8 +342,10 @@ const Result: FC<IResultProps> = ({setCompletionRes(res.join(''))},onError() {- if (isTimeout)+ if (isTimeout) {+ notify({ type: 'warning', message: t('appDebug.warningMessage.timeoutExceeded') })return+ }setRespondingFalse()onCompleted(getCompletionRes(), taskId, false)isEnd = truediff --git a/web/app/layout.tsx b/web/app/layout.tsxindex 008fdefa0b2..e9242edfade 100644--- a/web/app/layout.tsx+++ b/web/app/layout.tsx@@ -43,6 +43,7 @@ const LocaleLayout = ({data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}+ data-public-text-generation-timeout-ms={process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS}><Topbar /><BrowserInitor>diff --git a/web/config/index.ts b/web/config/index.tsindex 71edf8f939f..21fc2f211c9 100644--- a/web/config/index.ts+++ b/web/config/index.ts@@ -246,6 +246,13 @@ Thought: {{agent_scratchpad}}export const VAR_REGEX = /\{\{(#[a-zA-Z0-9_-]{1,50}(\.[a-zA-Z_][a-zA-Z0-9_]{0,29}){1,10}#)\}\}/gi-export const TEXT_GENERATION_TIMEOUT_MS = 60000+export let textGenerationTimeoutMs = 60000++if (process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS && process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS !== '')+ textGenerationTimeoutMs = parseInt(process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS)+else if (globalThis.document?.body?.getAttribute('data-public-text-generation-timeout-ms') && globalThis.document.body.getAttribute('data-public-text-generation-timeout-ms') !== '')+ textGenerationTimeoutMs = parseInt(globalThis.document.body.getAttribute('data-public-text-generation-timeout-ms') as string)++export const TEXT_GENERATION_TIMEOUT_MS = textGenerationTimeoutMsexport const DISABLE_UPLOAD_IMAGE_AS_ICON = process.env.NEXT_PUBLIC_DISABLE_UPLOAD_IMAGE_AS_ICON === 'true'diff --git a/web/docker/entrypoint.sh b/web/docker/entrypoint.shindex a19c543d684..fc4a8f45bc8 100755--- a/web/docker/entrypoint.sh+++ b/web/docker/entrypoint.sh@@ -21,4 +21,6 @@ export NEXT_PUBLIC_SENTRY_DSN=${SENTRY_DSN}export NEXT_PUBLIC_SITE_ABOUT=${SITE_ABOUT}export NEXT_TELEMETRY_DISABLED=${NEXT_TELEMETRY_DISABLED}+export NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS=${TEXT_GENERATION_TIMEOUT_MS}+pm2 start ./pm2.json --no-daemondiff --git a/web/i18n/en-US/app-debug.ts b/web/i18n/en-US/app-debug.tsindex b1f3f33cd82..3156c9f6cc5 100644--- a/web/i18n/en-US/app-debug.ts+++ b/web/i18n/en-US/app-debug.ts@@ -268,6 +268,9 @@ const translation = {notSelectModel: 'Please choose a model',waitForImgUpload: 'Please wait for the image to upload',},+ warningMessage: {+ timeoutExceeded: 'Results are not displayed due to timeout. Please refer to the logs to gather complete results.',+ },chatSubTitle: 'Instructions',completionSubTitle: 'Prefix Prompt',promptTip: