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
refactor: Replace direct `process.env.NODE_ENV` checks with `IS_PROD` and `IS_DEV` constants. (#30383)
yyh69589807fdab
diff --git a/web/app/components/base/date-and-time-picker/utils/dayjs.ts b/web/app/components/base/date-and-time-picker/utils/dayjs.tsindex b37808209cc..23307895a72 100644--- a/web/app/components/base/date-and-time-picker/utils/dayjs.ts+++ b/web/app/components/base/date-and-time-picker/utils/dayjs.ts@@ -3,6 +3,7 @@ import type { Day } from '../types'import dayjs from 'dayjs'import timezone from 'dayjs/plugin/timezone'import utc from 'dayjs/plugin/utc'+import { IS_PROD } from '@/config'import tz from '@/utils/timezone.json'dayjs.extend(utc)@@ -131,7 +132,7 @@ export type ToDayjsOptions = {}const warnParseFailure = (value: string) => {- if (process.env.NODE_ENV !== 'production')+ if (!IS_PROD)console.warn('[TimePicker] Failed to parse time value', value)}diff --git a/web/app/components/base/error-boundary/index.tsx b/web/app/components/base/error-boundary/index.tsxindex b041bba4d6a..9cb4b70cf52 100644--- a/web/app/components/base/error-boundary/index.tsx+++ b/web/app/components/base/error-boundary/index.tsx@@ -4,6 +4,7 @@ import { RiAlertLine, RiBugLine } from '@remixicon/react'import * as React from 'react'import { useCallback, useEffect, useRef, useState } from 'react'import Button from '@/app/components/base/button'+import { IS_DEV } from '@/config'import { cn } from '@/utils/classnames'type ErrorBoundaryState = {@@ -54,7 +55,7 @@ class ErrorBoundaryInner extends React.Component<}componentDidCatch(error: Error, errorInfo: ErrorInfo) {- if (process.env.NODE_ENV === 'development') {+ if (IS_DEV) {console.error('ErrorBoundary caught an error:', error)console.error('Error Info:', errorInfo)}@@ -262,13 +263,13 @@ export function withErrorBoundary<P extends object>(// Simple error fallback componentexport const ErrorFallback: React.FC<{error: Error- resetErrorBoundary: () => void-}> = ({ error, resetErrorBoundary }) => {+ resetErrorBoundaryAction: () => void+}> = ({ error, resetErrorBoundaryAction }) => {return (<div className="flex min-h-[200px] flex-col items-center justify-center rounded-lg border border-red-200 bg-red-50 p-8"><h2 className="mb-2 text-lg font-semibold text-red-800">Oops! Something went wrong</h2><p className="mb-4 text-center text-red-600">{error.message}</p>- <Button onClick={resetErrorBoundary} size="small">+ <Button onClick={resetErrorBoundaryAction} size="small">Try again</Button></div>diff --git a/web/app/components/base/ga/index.tsx b/web/app/components/base/ga/index.tsxindex eb991092e04..03475b3bb4b 100644--- a/web/app/components/base/ga/index.tsx+++ b/web/app/components/base/ga/index.tsx@@ -3,7 +3,7 @@ import type { FC } from 'react'import { headers } from 'next/headers'import Script from 'next/script'import * as React from 'react'-import { IS_CE_EDITION } from '@/config'+import { IS_CE_EDITION, IS_PROD } from '@/config'export enum GaType {admin = 'admin',@@ -32,7 +32,7 @@ const GA: FC<IGAProps> = ({if (IS_CE_EDITION)return null- const cspHeader = process.env.NODE_ENV === 'production'+ const cspHeader = IS_PROD? (headers() as unknown as UnsafeUnwrappedHeaders).get('content-security-policy'): nullconst nonce = extractNonceFromCSP(cspHeader)diff --git a/web/app/components/base/zendesk/index.tsx b/web/app/components/base/zendesk/index.tsxindex dc6ce1e6552..e12a128a02a 100644--- a/web/app/components/base/zendesk/index.tsx+++ b/web/app/components/base/zendesk/index.tsx@@ -1,13 +1,13 @@import { headers } from 'next/headers'import Script from 'next/script'import { memo } from 'react'-import { IS_CE_EDITION, ZENDESK_WIDGET_KEY } from '@/config'+import { IS_CE_EDITION, IS_PROD, ZENDESK_WIDGET_KEY } from '@/config'const Zendesk = async () => {if (IS_CE_EDITION || !ZENDESK_WIDGET_KEY)return null- const nonce = process.env.NODE_ENV === 'production' ? (await headers()).get('x-nonce') ?? '' : ''+ const nonce = IS_PROD ? (await headers()).get('x-nonce') ?? '' : ''return (<>diff --git a/web/app/components/header/github-star/index.tsx b/web/app/components/header/github-star/index.tsxindex 01f30fba311..e91bdcca2ce 100644--- a/web/app/components/header/github-star/index.tsx+++ b/web/app/components/header/github-star/index.tsx@@ -3,6 +3,7 @@ import type { FC } from 'react'import type { GithubRepo } from '@/models/common'import { RiLoader2Line } from '@remixicon/react'import { useQuery } from '@tanstack/react-query'+import { IS_DEV } from '@/config'const defaultData = {stargazers_count: 110918,@@ -21,7 +22,7 @@ const GithubStar: FC<{ className: string }> = (props) => {const { isFetching, isError, data } = useQuery<GithubRepo>({queryKey: ['github-star'],queryFn: getStar,- enabled: process.env.NODE_ENV !== 'development',+ enabled: !IS_DEV,retry: false,placeholderData: defaultData,})diff --git a/web/service/use-common.ts b/web/service/use-common.tsindex 77bb2a11fa6..a1edb041c07 100644--- a/web/service/use-common.ts+++ b/web/service/use-common.ts@@ -23,6 +23,7 @@ import type {} from '@/models/common'import type { RETRIEVE_METHOD } from '@/types/app'import { useMutation, useQuery } from '@tanstack/react-query'+import { IS_DEV } from '@/config'import { get, post } from './base'import { useInvalid } from './use-base'@@ -85,7 +86,7 @@ export const useUserProfile = () => {profile,meta: {currentVersion: response.headers.get('x-version'),- currentEnv: process.env.NODE_ENV === 'development'+ currentEnv: IS_DEV? 'DEVELOPMENT': response.headers.get('x-env'),},