feat: add config for max-tree-depth

pull/21291/head
G.Wood-Sun 11 months ago
parent d333aac84a
commit d42b340f2f

@ -56,3 +56,5 @@ NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER=true
NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL=true NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL=true
NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL=true NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL=true
# The maximum number of tree node depth for workflow
NEXT_PUBLIC_MAX_TREE_DEPTH=50

@ -408,7 +408,6 @@ export const NODE_WIDTH = 240
export const X_OFFSET = 60 export const X_OFFSET = 60
export const NODE_WIDTH_X_OFFSET = NODE_WIDTH + X_OFFSET export const NODE_WIDTH_X_OFFSET = NODE_WIDTH + X_OFFSET
export const Y_OFFSET = 39 export const Y_OFFSET = 39
export const MAX_TREE_DEPTH = 50
export const START_INITIAL_POSITION = { x: 80, y: 282 } export const START_INITIAL_POSITION = { x: 80, y: 282 }
export const AUTO_LAYOUT_OFFSET = { export const AUTO_LAYOUT_OFFSET = {
x: -42, x: -42,

@ -18,7 +18,6 @@ import {
} from '../utils' } from '../utils'
import { import {
CUSTOM_NODE, CUSTOM_NODE,
MAX_TREE_DEPTH,
} from '../constants' } from '../constants'
import type { ToolNodeType } from '../nodes/tool/types' import type { ToolNodeType } from '../nodes/tool/types'
import { useIsChatMode } from './use-workflow' import { useIsChatMode } from './use-workflow'
@ -33,6 +32,7 @@ import { useDatasetsDetailStore } from '../datasets-detail-store/store'
import type { KnowledgeRetrievalNodeType } from '../nodes/knowledge-retrieval/types' import type { KnowledgeRetrievalNodeType } from '../nodes/knowledge-retrieval/types'
import type { DataSet } from '@/models/datasets' import type { DataSet } from '@/models/datasets'
import { fetchDatasets } from '@/service/datasets' import { fetchDatasets } from '@/service/datasets'
import { MAX_TREE_DEPTH } from '@/config'
export const useChecklist = (nodes: Node[], edges: Edge[]) => { export const useChecklist = (nodes: Node[], edges: Edge[]) => {
const { t } = useTranslation() const { t } = useTranslation()

@ -54,6 +54,7 @@ const LocaleLayout = async ({
data-public-enable-website-jinareader={process.env.NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER} data-public-enable-website-jinareader={process.env.NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER}
data-public-enable-website-firecrawl={process.env.NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL} data-public-enable-website-firecrawl={process.env.NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL}
data-public-enable-website-watercrawl={process.env.NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL} data-public-enable-website-watercrawl={process.env.NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL}
data-public-max-tree-depth={process.env.NEXT_PUBLIC_MAX_TREE_DEPTH}
> >
<BrowserInitor> <BrowserInitor>
<SentryInitor> <SentryInitor>

@ -323,3 +323,12 @@ enableWebsiteWaterCrawl = getBooleanConfig(process.env.NEXT_PUBLIC_ENABLE_WEBSIT
export const ENABLE_WEBSITE_JINAREADER = enableWebsiteJinaReader export const ENABLE_WEBSITE_JINAREADER = enableWebsiteJinaReader
export const ENABLE_WEBSITE_FIRECRAWL = enableWebsiteFireCrawl export const ENABLE_WEBSITE_FIRECRAWL = enableWebsiteFireCrawl
export const ENABLE_WEBSITE_WATERCRAWL = enableWebsiteWaterCrawl export const ENABLE_WEBSITE_WATERCRAWL = enableWebsiteWaterCrawl
let defaultMaxTreeDepth = 50
if (process.env.NEXT_PUBLIC_MAX_TREE_DEPTH && process.env.NEXT_PUBLIC_MAX_TREE_DEPTH !== '')
defaultMaxTreeDepth = Number.parseInt(process.env.NEXT_PUBLIC_MAX_TREE_DEPTH)
else if (globalThis.document?.body?.getAttribute('data-public-max-tree-depth') && globalThis.document.body.getAttribute('data-public-max-tree-depth') !== '')
defaultMaxTreeDepth = Number.parseInt(globalThis.document.body.getAttribute('data-public-max-tree-depth') as string)
export const MAX_TREE_DEPTH = defaultMaxTreeDepth

@ -35,4 +35,5 @@ export NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL=${ENABLE_WEBSITE_WATERCRAWL:-true}
export NEXT_PUBLIC_LOOP_NODE_MAX_COUNT=${LOOP_NODE_MAX_COUNT} export NEXT_PUBLIC_LOOP_NODE_MAX_COUNT=${LOOP_NODE_MAX_COUNT}
export NEXT_PUBLIC_MAX_PARALLEL_LIMIT=${MAX_PARALLEL_LIMIT} export NEXT_PUBLIC_MAX_PARALLEL_LIMIT=${MAX_PARALLEL_LIMIT}
export NEXT_PUBLIC_MAX_ITERATIONS_NUM=${MAX_ITERATIONS_NUM} export NEXT_PUBLIC_MAX_ITERATIONS_NUM=${MAX_ITERATIONS_NUM}
export NEXT_PUBLIC_MAX_TREE_DEPTH=${MAX_TREE_DEPTH}
pm2 start /app/web/server.js --name dify-web --cwd /app/web -i ${PM2_INSTANCES} --no-daemon pm2 start /app/web/server.js --name dify-web --cwd /app/web -i ${PM2_INSTANCES} --no-daemon

Loading…
Cancel
Save