mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 03:29:01 +08:00
feat(tool_node): Suppress exceptions thrown by the Tool (#11724)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
parent
74fdc16bd1
commit
92a840f1b2
@ -271,9 +271,9 @@ class WorkflowCycleManage:
|
|||||||
|
|
||||||
db.session.close()
|
db.session.close()
|
||||||
|
|
||||||
with Session(db.engine, expire_on_commit=False) as session:
|
# with Session(db.engine, expire_on_commit=False) as session:
|
||||||
session.add(workflow_run)
|
# session.add(workflow_run)
|
||||||
session.refresh(workflow_run)
|
# session.refresh(workflow_run)
|
||||||
|
|
||||||
if trace_manager:
|
if trace_manager:
|
||||||
trace_manager.add_trace_task(
|
trace_manager.add_trace_task(
|
||||||
|
@ -92,6 +92,16 @@ class ToolNode(BaseNode[ToolNodeData]):
|
|||||||
error=f"Failed to invoke tool: {str(e)}",
|
error=f"Failed to invoke tool: {str(e)}",
|
||||||
error_type=type(e).__name__,
|
error_type=type(e).__name__,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
return NodeRunResult(
|
||||||
|
status=WorkflowNodeExecutionStatus.FAILED,
|
||||||
|
inputs=parameters_for_log,
|
||||||
|
metadata={
|
||||||
|
NodeRunMetadataKey.TOOL_INFO: tool_info,
|
||||||
|
},
|
||||||
|
error=f"Failed to invoke tool: {str(e)}",
|
||||||
|
error_type="UnknownError",
|
||||||
|
)
|
||||||
|
|
||||||
# convert tool messages
|
# convert tool messages
|
||||||
plain_text, files, json = self._convert_tool_messages(messages)
|
plain_text, files, json = self._convert_tool_messages(messages)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user