Browse Source

fix(app_generator): improve error handling for closed file I/O operat… (#12073)

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/0.15.0
-LAN- 10 months ago
parent
commit
39ace9bdee
No account linked to committer's email address

+ 1
- 1
api/core/app/apps/advanced_chat/app_generator.py View File

@@ -383,7 +383,7 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator):
try:
return generate_task_pipeline.process()
except ValueError as e:
if e.args[0] == "I/O operation on closed file.": # ignore this error
if len(e.args) > 0 and e.args[0] == "I/O operation on closed file.": # ignore this error
raise GenerateTaskStoppedError()
else:
logger.exception(f"Failed to process generate task pipeline, conversation_id: {conversation.id}")

+ 1
- 1
api/core/app/apps/message_based_app_generator.py View File

@@ -76,7 +76,7 @@ class MessageBasedAppGenerator(BaseAppGenerator):
try:
return generate_task_pipeline.process()
except ValueError as e:
if e.args[0] == "I/O operation on closed file.": # ignore this error
if len(e.args) > 0 and e.args[0] == "I/O operation on closed file.": # ignore this error
raise GenerateTaskStoppedError()
else:
logger.exception(f"Failed to handle response, conversation_id: {conversation.id}")

+ 1
- 1
api/core/app/apps/workflow/app_generator.py View File

@@ -309,7 +309,7 @@ class WorkflowAppGenerator(BaseAppGenerator):
try:
return generate_task_pipeline.process()
except ValueError as e:
if e.args[0] == "I/O operation on closed file.": # ignore this error
if len(e.args) > 0 and e.args[0] == "I/O operation on closed file.": # ignore this error
raise GenerateTaskStoppedError()
else:
logger.exception(

+ 1
- 1
api/core/tools/tool_engine.py View File

@@ -113,7 +113,7 @@ class ToolEngine:
error_response = f"tool invoke error: {e}"
agent_tool_callback.on_tool_error(e)
except ToolEngineInvokeError as e:
meta = e.args[0]
meta = e.meta
error_response = f"tool invoke error: {meta.error}"
agent_tool_callback.on_tool_error(e)
return error_response, [], meta

Loading…
Cancel
Save