Files
gsfdc/demo-dify/dify/api/services/agent/errors.py
T
wuzilongandCursor 6519682885 chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 13:59:25 +08:00

96 lines
2.8 KiB
Python

from werkzeug.exceptions import BadRequest, Conflict, NotFound
from libs.exception import BaseHTTPException
class AgentNotFoundError(NotFound):
description = "Agent not found."
class AgentVersionNotFoundError(NotFound):
description = "Agent config version not found."
class AgentNameConflictError(Conflict):
description = "Agent name already exists."
class AgentArchivedError(Conflict):
description = "Archived agent cannot be modified."
class AgentVersionConflictError(Conflict):
description = "Agent config version changed. Please reload and try again."
class AgentModelNotConfiguredError(BaseHTTPException):
error_code = "agent_model_not_configured"
description = "Agent App requires the Agent Soul model to be configured."
code = 400
class AgentAccessNotReadyError(BaseHTTPException):
error_code = "agent_not_published"
description = "Publish the Agent before enabling Web App or API access."
code = 409
class AgentBuildSandboxNotFoundError(BaseHTTPException):
error_code = "agent_build_sandbox_not_found"
description = "The retained Build Sandbox is no longer available."
code = 404
class AgentHomeSnapshotCreateFailedError(BaseHTTPException):
error_code = "agent_home_snapshot_create_failed"
description = "Failed to capture the Agent Home Snapshot."
code = 502
class AgentHomeSnapshotTooLargeError(BaseHTTPException):
error_code = "agent_home_snapshot_too_large"
description = "The Agent Home Snapshot exceeds the configured size limit."
code = 413
class InvalidRosterAgentPackageError(BaseHTTPException):
error_code = "invalid_roster_agent_package"
description = "The Roster Agent package is invalid."
code = 400
class RosterAgentPackageTooLargeError(BaseHTTPException):
error_code = "roster_agent_package_too_large"
description = "The Roster Agent package exceeds the size limit."
code = 413
class RosterAgentPackageExportFailedError(BaseHTTPException):
error_code = "roster_agent_package_export_failed"
description = "The Roster Agent package could not be exported."
code = 500
class RosterAgentPackageImportFailedError(BaseHTTPException):
error_code = "roster_agent_package_import_failed"
description = "The Roster Agent package could not be imported."
code = 500
class RosterAgentPackageResourceUnavailableError(BaseHTTPException):
error_code = "roster_agent_package_resource_unavailable"
description = "The Roster Agent package resources could not be stored."
code = 503
class AgentSoulLockedError(BadRequest):
description = "Agent Soul is locked for this workflow node."
class InvalidComposerConfigError(BadRequest):
description = "Invalid agent composer config."
class PlaintextSecretNotAllowedError(BadRequest):
description = "Plaintext secret values are not allowed in Agent config."