mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-04 11:14:10 +08:00
chore: remove agent turn limits (#19930)
This commit is contained in:
parent
9bbd646f40
commit
b2ab401279
@ -63,7 +63,7 @@ class CotAgentRunner(BaseAgentRunner, ABC):
|
|||||||
self._instruction = self._fill_in_inputs_from_external_data_tools(instruction, inputs)
|
self._instruction = self._fill_in_inputs_from_external_data_tools(instruction, inputs)
|
||||||
|
|
||||||
iteration_step = 1
|
iteration_step = 1
|
||||||
max_iteration_steps = min(app_config.agent.max_iteration if app_config.agent else 5, 5) + 1
|
max_iteration_steps = min(app_config.agent.max_iteration, 99) + 1
|
||||||
|
|
||||||
# convert tools into ModelRuntime Tool format
|
# convert tools into ModelRuntime Tool format
|
||||||
tool_instances, prompt_messages_tools = self._init_prompt_tools()
|
tool_instances, prompt_messages_tools = self._init_prompt_tools()
|
||||||
|
@ -82,7 +82,7 @@ class AgentEntity(BaseModel):
|
|||||||
strategy: Strategy
|
strategy: Strategy
|
||||||
prompt: Optional[AgentPromptEntity] = None
|
prompt: Optional[AgentPromptEntity] = None
|
||||||
tools: Optional[list[AgentToolEntity]] = None
|
tools: Optional[list[AgentToolEntity]] = None
|
||||||
max_iteration: int = 5
|
max_iteration: int = 10
|
||||||
|
|
||||||
|
|
||||||
class AgentInvokeMessage(ToolInvokeMessage):
|
class AgentInvokeMessage(ToolInvokeMessage):
|
||||||
|
@ -48,7 +48,7 @@ class FunctionCallAgentRunner(BaseAgentRunner):
|
|||||||
assert app_config.agent
|
assert app_config.agent
|
||||||
|
|
||||||
iteration_step = 1
|
iteration_step = 1
|
||||||
max_iteration_steps = min(app_config.agent.max_iteration, 5) + 1
|
max_iteration_steps = min(app_config.agent.max_iteration, 99) + 1
|
||||||
|
|
||||||
# continue to run until there is not any tool call
|
# continue to run until there is not any tool call
|
||||||
function_call_state = True
|
function_call_state = True
|
||||||
|
@ -75,7 +75,7 @@ class AgentConfigManager:
|
|||||||
strategy=strategy,
|
strategy=strategy,
|
||||||
prompt=agent_prompt_entity,
|
prompt=agent_prompt_entity,
|
||||||
tools=agent_tools,
|
tools=agent_tools,
|
||||||
max_iteration=agent_dict.get("max_iteration", 5),
|
max_iteration=agent_dict.get("max_iteration", 10),
|
||||||
)
|
)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -802,7 +802,7 @@ MAX_TOOLS_NUM=10
|
|||||||
MAX_PARALLEL_LIMIT=10
|
MAX_PARALLEL_LIMIT=10
|
||||||
|
|
||||||
# The maximum number of iterations for agent setting
|
# The maximum number of iterations for agent setting
|
||||||
MAX_ITERATIONS_NUM=5
|
MAX_ITERATIONS_NUM=99
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# Environment Variables for web Service
|
# Environment Variables for web Service
|
||||||
|
@ -75,7 +75,7 @@ services:
|
|||||||
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}
|
MAX_ITERATIONS_NUM: ${MAX_ITERATIONS_NUM:-99}
|
||||||
ENABLE_WEBSITE_JINAREADER: ${ENABLE_WEBSITE_JINAREADER:-true}
|
ENABLE_WEBSITE_JINAREADER: ${ENABLE_WEBSITE_JINAREADER:-true}
|
||||||
ENABLE_WEBSITE_FIRECRAWL: ${ENABLE_WEBSITE_FIRECRAWL:-true}
|
ENABLE_WEBSITE_FIRECRAWL: ${ENABLE_WEBSITE_FIRECRAWL:-true}
|
||||||
ENABLE_WEBSITE_WATERCRAWL: ${ENABLE_WEBSITE_WATERCRAWL:-true}
|
ENABLE_WEBSITE_WATERCRAWL: ${ENABLE_WEBSITE_WATERCRAWL:-true}
|
||||||
|
@ -354,7 +354,7 @@ x-shared-env: &shared-api-worker-env
|
|||||||
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}
|
MAX_ITERATIONS_NUM: ${MAX_ITERATIONS_NUM:-99}
|
||||||
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}}
|
||||||
@ -574,7 +574,7 @@ services:
|
|||||||
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}
|
MAX_ITERATIONS_NUM: ${MAX_ITERATIONS_NUM:-99}
|
||||||
ENABLE_WEBSITE_JINAREADER: ${ENABLE_WEBSITE_JINAREADER:-true}
|
ENABLE_WEBSITE_JINAREADER: ${ENABLE_WEBSITE_JINAREADER:-true}
|
||||||
ENABLE_WEBSITE_FIRECRAWL: ${ENABLE_WEBSITE_FIRECRAWL:-true}
|
ENABLE_WEBSITE_FIRECRAWL: ${ENABLE_WEBSITE_FIRECRAWL:-true}
|
||||||
ENABLE_WEBSITE_WATERCRAWL: ${ENABLE_WEBSITE_WATERCRAWL:-true}
|
ENABLE_WEBSITE_WATERCRAWL: ${ENABLE_WEBSITE_WATERCRAWL:-true}
|
||||||
|
@ -50,7 +50,7 @@ NEXT_PUBLIC_MAX_TOOLS_NUM=10
|
|||||||
NEXT_PUBLIC_MAX_PARALLEL_LIMIT=10
|
NEXT_PUBLIC_MAX_PARALLEL_LIMIT=10
|
||||||
|
|
||||||
# The maximum number of iterations for agent setting
|
# The maximum number of iterations for agent setting
|
||||||
NEXT_PUBLIC_MAX_ITERATIONS_NUM=5
|
NEXT_PUBLIC_MAX_ITERATIONS_NUM=99
|
||||||
|
|
||||||
NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER=true
|
NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER=true
|
||||||
NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL=true
|
NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL=true
|
||||||
|
@ -173,7 +173,7 @@ export const MAX_TOOLS_NUM = maxToolsNum
|
|||||||
|
|
||||||
export const DEFAULT_AGENT_SETTING = {
|
export const DEFAULT_AGENT_SETTING = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
max_iteration: 5,
|
max_iteration: 10,
|
||||||
strategy: AgentStrategy.functionCall,
|
strategy: AgentStrategy.functionCall,
|
||||||
tools: [],
|
tools: [],
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ else if (globalThis.document?.body?.getAttribute('data-public-loop-node-max-coun
|
|||||||
|
|
||||||
export const LOOP_NODE_MAX_COUNT = loopNodeMaxCount
|
export const LOOP_NODE_MAX_COUNT = loopNodeMaxCount
|
||||||
|
|
||||||
let maxIterationsNum = 5
|
let maxIterationsNum = 99
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM && process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM !== '')
|
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)
|
maxIterationsNum = Number.parseInt(process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user