mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 15:45:53 +08:00
fix: api tool provider not found (#2782)
This commit is contained in:
parent
6454e1d644
commit
f8951d7f57
@ -247,6 +247,7 @@ class AppApi(Resource):
|
|||||||
for tool in agent_mode.get('tools') or []:
|
for tool in agent_mode.get('tools') or []:
|
||||||
agent_tool_entity = AgentToolEntity(**tool)
|
agent_tool_entity = AgentToolEntity(**tool)
|
||||||
# get tool
|
# get tool
|
||||||
|
try:
|
||||||
tool_runtime = ToolManager.get_agent_tool_runtime(
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
||||||
tenant_id=current_user.current_tenant_id,
|
tenant_id=current_user.current_tenant_id,
|
||||||
agent_tool=agent_tool_entity,
|
agent_tool=agent_tool_entity,
|
||||||
@ -268,6 +269,8 @@ class AppApi(Resource):
|
|||||||
|
|
||||||
# override tool parameters
|
# override tool parameters
|
||||||
tool['tool_parameters'] = masked_parameter
|
tool['tool_parameters'] = masked_parameter
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
# override agent mode
|
# override agent mode
|
||||||
model_config.agent_mode = json.dumps(agent_mode)
|
model_config.agent_mode = json.dumps(agent_mode)
|
||||||
|
@ -54,6 +54,7 @@ class ModelConfigResource(Resource):
|
|||||||
for tool in agent_mode.get('tools') or []:
|
for tool in agent_mode.get('tools') or []:
|
||||||
agent_tool_entity = AgentToolEntity(**tool)
|
agent_tool_entity = AgentToolEntity(**tool)
|
||||||
# get tool
|
# get tool
|
||||||
|
try:
|
||||||
tool_runtime = ToolManager.get_agent_tool_runtime(
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
||||||
tenant_id=current_user.current_tenant_id,
|
tenant_id=current_user.current_tenant_id,
|
||||||
agent_tool=agent_tool_entity,
|
agent_tool=agent_tool_entity,
|
||||||
@ -65,6 +66,8 @@ class ModelConfigResource(Resource):
|
|||||||
provider_name=agent_tool_entity.provider_id,
|
provider_name=agent_tool_entity.provider_id,
|
||||||
provider_type=agent_tool_entity.provider_type,
|
provider_type=agent_tool_entity.provider_type,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
continue
|
||||||
|
|
||||||
# get decrypted parameters
|
# get decrypted parameters
|
||||||
if agent_tool_entity.tool_parameters:
|
if agent_tool_entity.tool_parameters:
|
||||||
@ -89,11 +92,14 @@ class ModelConfigResource(Resource):
|
|||||||
if key in tool_map:
|
if key in tool_map:
|
||||||
tool_runtime = tool_map[key]
|
tool_runtime = tool_map[key]
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
tool_runtime = ToolManager.get_agent_tool_runtime(
|
tool_runtime = ToolManager.get_agent_tool_runtime(
|
||||||
tenant_id=current_user.current_tenant_id,
|
tenant_id=current_user.current_tenant_id,
|
||||||
agent_tool=agent_tool_entity,
|
agent_tool=agent_tool_entity,
|
||||||
agent_callback=None
|
agent_callback=None
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
continue
|
||||||
|
|
||||||
manager = ToolParameterConfigurationManager(
|
manager = ToolParameterConfigurationManager(
|
||||||
tenant_id=current_user.current_tenant_id,
|
tenant_id=current_user.current_tenant_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user