|
|
|
|
@ -54,17 +54,20 @@ class ModelConfigResource(Resource):
|
|
|
|
|
for tool in agent_mode.get('tools') or []:
|
|
|
|
|
agent_tool_entity = AgentToolEntity(**tool)
|
|
|
|
|
# get tool
|
|
|
|
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
agent_tool=agent_tool_entity,
|
|
|
|
|
agent_callback=None
|
|
|
|
|
)
|
|
|
|
|
manager = ToolParameterConfigurationManager(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
tool_runtime=tool_runtime,
|
|
|
|
|
provider_name=agent_tool_entity.provider_id,
|
|
|
|
|
provider_type=agent_tool_entity.provider_type,
|
|
|
|
|
)
|
|
|
|
|
try:
|
|
|
|
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
agent_tool=agent_tool_entity,
|
|
|
|
|
agent_callback=None
|
|
|
|
|
)
|
|
|
|
|
manager = ToolParameterConfigurationManager(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
tool_runtime=tool_runtime,
|
|
|
|
|
provider_name=agent_tool_entity.provider_id,
|
|
|
|
|
provider_type=agent_tool_entity.provider_type,
|
|
|
|
|
)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# get decrypted parameters
|
|
|
|
|
if agent_tool_entity.tool_parameters:
|
|
|
|
|
@ -89,11 +92,14 @@ class ModelConfigResource(Resource):
|
|
|
|
|
if key in tool_map:
|
|
|
|
|
tool_runtime = tool_map[key]
|
|
|
|
|
else:
|
|
|
|
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
agent_tool=agent_tool_entity,
|
|
|
|
|
agent_callback=None
|
|
|
|
|
)
|
|
|
|
|
try:
|
|
|
|
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
agent_tool=agent_tool_entity,
|
|
|
|
|
agent_callback=None
|
|
|
|
|
)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
manager = ToolParameterConfigurationManager(
|
|
|
|
|
tenant_id=current_user.current_tenant_id,
|
|
|
|
|
|