Co-authored-by: Xiaoba Yu <xb1823725853@gmail.com>tags/1.2.0
| # Maximum number of Parallelism branches in the workflow | # Maximum number of Parallelism branches in the workflow | ||||
| MAX_PARALLEL_LIMIT=10 | MAX_PARALLEL_LIMIT=10 | ||||
| # The maximum number of iterations for agent setting | |||||
| MAX_ITERATIONS_NUM=5 | |||||
| # ------------------------------ | # ------------------------------ | ||||
| # Environment Variables for web Service | # Environment Variables for web Service | ||||
| # ------------------------------ | # ------------------------------ |
| LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100} | LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100} | ||||
| MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10} | MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10} | ||||
| MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10} | MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10} | ||||
| MAX_ITERATIONS_NUM: ${MAX_ITERATIONS_NUM:-5} | |||||
| # The postgres database. | # The postgres database. | ||||
| db: | db: |
| LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100} | LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100} | ||||
| MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10} | MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10} | ||||
| MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10} | MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10} | ||||
| MAX_ITERATIONS_NUM: ${MAX_ITERATIONS_NUM:-5} | |||||
| TEXT_GENERATION_TIMEOUT_MS: ${TEXT_GENERATION_TIMEOUT_MS:-60000} | TEXT_GENERATION_TIMEOUT_MS: ${TEXT_GENERATION_TIMEOUT_MS:-60000} | ||||
| PGUSER: ${PGUSER:-${DB_USERNAME}} | PGUSER: ${PGUSER:-${DB_USERNAME}} | ||||
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-${DB_PASSWORD}} | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-${DB_PASSWORD}} | ||||
| LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100} | LOOP_NODE_MAX_COUNT: ${LOOP_NODE_MAX_COUNT:-100} | ||||
| MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10} | MAX_TOOLS_NUM: ${MAX_TOOLS_NUM:-10} | ||||
| MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10} | MAX_PARALLEL_LIMIT: ${MAX_PARALLEL_LIMIT:-10} | ||||
| MAX_ITERATIONS_NUM: ${MAX_ITERATIONS_NUM:-5} | |||||
| # The postgres database. | # The postgres database. | ||||
| db: | db: |
| NEXT_PUBLIC_MAX_TOOLS_NUM=10 | NEXT_PUBLIC_MAX_TOOLS_NUM=10 | ||||
| # Maximum number of Parallelism branches in the workflow | # Maximum number of Parallelism branches in the workflow | ||||
| NEXT_PUBLIC_MAX_PARALLEL_LIMIT=10 | |||||
| NEXT_PUBLIC_MAX_PARALLEL_LIMIT=10 | |||||
| # The maximum number of iterations for agent setting | |||||
| NEXT_PUBLIC_MAX_ITERATIONS_NUM=5 |
| import { Unblur } from '@/app/components/base/icons/src/vender/solid/education' | import { Unblur } from '@/app/components/base/icons/src/vender/solid/education' | ||||
| import Slider from '@/app/components/base/slider' | import Slider from '@/app/components/base/slider' | ||||
| import type { AgentConfig } from '@/models/debug' | import type { AgentConfig } from '@/models/debug' | ||||
| import { DEFAULT_AGENT_PROMPT } from '@/config' | |||||
| import { DEFAULT_AGENT_PROMPT, MAX_ITERATIONS_NUM } from '@/config' | |||||
| type Props = { | type Props = { | ||||
| isChatModel: boolean | isChatModel: boolean | ||||
| } | } | ||||
| const maxIterationsMin = 1 | const maxIterationsMin = 1 | ||||
| const maxIterationsMax = 5 | |||||
| const AgentSetting: FC<Props> = ({ | const AgentSetting: FC<Props> = ({ | ||||
| isChatModel, | isChatModel, | ||||
| <Slider | <Slider | ||||
| className='mr-3 w-[156px]' | className='mr-3 w-[156px]' | ||||
| min={maxIterationsMin} | min={maxIterationsMin} | ||||
| max={maxIterationsMax} | |||||
| max={MAX_ITERATIONS_NUM} | |||||
| value={tempPayload.max_iteration} | value={tempPayload.max_iteration} | ||||
| onChange={(value) => { | onChange={(value) => { | ||||
| setTempPayload({ | setTempPayload({ | ||||
| <input | <input | ||||
| type="number" | type="number" | ||||
| min={maxIterationsMin} | min={maxIterationsMin} | ||||
| max={maxIterationsMax} step={1} | |||||
| max={MAX_ITERATIONS_NUM} step={1} | |||||
| className="block h-7 w-11 rounded-lg border-0 bg-components-input-bg-normal px-1.5 pl-1 leading-7 text-text-primary placeholder:text-text-tertiary focus:ring-1 focus:ring-inset focus:ring-primary-600" | className="block h-7 w-11 rounded-lg border-0 bg-components-input-bg-normal px-1.5 pl-1 leading-7 text-text-primary placeholder:text-text-tertiary focus:ring-1 focus:ring-inset focus:ring-primary-600" | ||||
| value={tempPayload.max_iteration} | value={tempPayload.max_iteration} | ||||
| onChange={(e) => { | onChange={(e) => { | ||||
| if (value < maxIterationsMin) | if (value < maxIterationsMin) | ||||
| value = maxIterationsMin | value = maxIterationsMin | ||||
| if (value > maxIterationsMax) | |||||
| value = maxIterationsMax | |||||
| if (value > MAX_ITERATIONS_NUM) | |||||
| value = MAX_ITERATIONS_NUM | |||||
| setTempPayload({ | setTempPayload({ | ||||
| ...tempPayload, | ...tempPayload, | ||||
| max_iteration: value, | max_iteration: value, |
| data-public-top-k-max-value={process.env.NEXT_PUBLIC_TOP_K_MAX_VALUE} | 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-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} | data-public-loop-node-max-count={process.env.NEXT_PUBLIC_LOOP_NODE_MAX_COUNT} | ||||
| data-public-max-iterations-num={process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM} | |||||
| > | > | ||||
| <BrowserInitor> | <BrowserInitor> | ||||
| <SentryInitor> | <SentryInitor> |
| loopNodeMaxCount = Number.parseInt(globalThis.document.body.getAttribute('data-public-loop-node-max-count') as string) | loopNodeMaxCount = Number.parseInt(globalThis.document.body.getAttribute('data-public-loop-node-max-count') as string) | ||||
| export const LOOP_NODE_MAX_COUNT = loopNodeMaxCount | export const LOOP_NODE_MAX_COUNT = loopNodeMaxCount | ||||
| let maxIterationsNum = 5 | |||||
| if (process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM && process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM !== '') | |||||
| maxIterationsNum = Number.parseInt(process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM) | |||||
| else if (globalThis.document?.body?.getAttribute('data-public-max-iterations-num') && globalThis.document.body.getAttribute('data-public-max-iterations-num') !== '') | |||||
| maxIterationsNum = Number.parseInt(globalThis.document.body.getAttribute('data-public-max-iterations-num') as string) | |||||
| export const MAX_ITERATIONS_NUM = maxIterationsNum |