mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 08:57:28 +08:00
Resolve the full dependency chain to enable all previously disabled controllers: Enabled routes: - sandbox_files: sandbox file browser API - sandbox_providers: sandbox provider management API - app_asset: app asset management API - skills: skill extraction API - CLI API blueprint: DifyCli callback endpoints (/cli/api/*) Dependencies extracted (64 files, ~8000 lines): - models/sandbox.py, models/app_asset.py: DB models - core/zip_sandbox/: zip-based sandbox execution - core/session/: CLI API session management - core/memory/: base memory + node token buffer - core/helper/creators.py: helper utilities - core/llm_generator/: context models, output models, utils - core/workflow/nodes/command/: command node type - core/workflow/nodes/file_upload/: file upload node type - core/app/entities/: app_asset_entities, app_bundle_entities, llm_generation_entities - services/: asset_content, skill, workflow_collaboration, workflow_comment - controllers/console/app/error.py: AppAsset error classes - core/tools/utils/system_encryption.py Import fixes: - dify_graph.enums -> graphon.enums in skill_service.py - get_signed_file_url_for_plugin -> get_signed_file_url in cli_api.py All 5 controllers verified: import OK, Flask starts successfully. 46 existing tests still pass. Made-with: Cursor
142 lines
3.9 KiB
Python
142 lines
3.9 KiB
Python
from libs.exception import BaseHTTPException
|
|
|
|
|
|
class AppNotFoundError(BaseHTTPException):
|
|
error_code = "app_not_found"
|
|
description = "App not found."
|
|
code = 404
|
|
|
|
|
|
class ProviderNotInitializeError(BaseHTTPException):
|
|
error_code = "provider_not_initialize"
|
|
description = (
|
|
"No valid model provider credentials found. "
|
|
"Please go to Settings -> Model Provider to complete your provider credentials."
|
|
)
|
|
code = 400
|
|
|
|
|
|
class ProviderQuotaExceededError(BaseHTTPException):
|
|
error_code = "provider_quota_exceeded"
|
|
description = (
|
|
"Your quota for Dify Hosted Model Provider has been exhausted. "
|
|
"Please go to Settings -> Model Provider to complete your own provider credentials."
|
|
)
|
|
code = 400
|
|
|
|
|
|
class ProviderModelCurrentlyNotSupportError(BaseHTTPException):
|
|
error_code = "model_currently_not_support"
|
|
description = "Dify Hosted OpenAI trial currently not support the GPT-4 model."
|
|
code = 400
|
|
|
|
|
|
class ConversationCompletedError(BaseHTTPException):
|
|
error_code = "conversation_completed"
|
|
description = "The conversation has ended. Please start a new conversation."
|
|
code = 400
|
|
|
|
|
|
class AppUnavailableError(BaseHTTPException):
|
|
error_code = "app_unavailable"
|
|
description = "App unavailable, please check your app configurations."
|
|
code = 400
|
|
|
|
|
|
class CompletionRequestError(BaseHTTPException):
|
|
error_code = "completion_request_error"
|
|
description = "Completion request failed."
|
|
code = 400
|
|
|
|
|
|
class AppMoreLikeThisDisabledError(BaseHTTPException):
|
|
error_code = "app_more_like_this_disabled"
|
|
description = "The 'More like this' feature is disabled. Please refresh your page."
|
|
code = 403
|
|
|
|
|
|
class NoAudioUploadedError(BaseHTTPException):
|
|
error_code = "no_audio_uploaded"
|
|
description = "Please upload your audio."
|
|
code = 400
|
|
|
|
|
|
class AudioTooLargeError(BaseHTTPException):
|
|
error_code = "audio_too_large"
|
|
description = "Audio size exceeded. {message}"
|
|
code = 413
|
|
|
|
|
|
class UnsupportedAudioTypeError(BaseHTTPException):
|
|
error_code = "unsupported_audio_type"
|
|
description = "Audio type not allowed."
|
|
code = 415
|
|
|
|
|
|
class ProviderNotSupportSpeechToTextError(BaseHTTPException):
|
|
error_code = "provider_not_support_speech_to_text"
|
|
description = "Provider not support speech to text."
|
|
code = 400
|
|
|
|
|
|
class DraftWorkflowNotExist(BaseHTTPException):
|
|
error_code = "draft_workflow_not_exist"
|
|
description = "Draft workflow need to be initialized."
|
|
code = 404
|
|
|
|
|
|
class DraftWorkflowNotSync(BaseHTTPException):
|
|
error_code = "draft_workflow_not_sync"
|
|
description = "Workflow graph might have been modified, please refresh and resubmit."
|
|
code = 409
|
|
|
|
|
|
class TracingConfigNotExist(BaseHTTPException):
|
|
error_code = "trace_config_not_exist"
|
|
description = "Trace config not exist."
|
|
code = 400
|
|
|
|
|
|
class TracingConfigIsExist(BaseHTTPException):
|
|
error_code = "trace_config_is_exist"
|
|
description = "Trace config is exist."
|
|
code = 400
|
|
|
|
|
|
class TracingConfigCheckError(BaseHTTPException):
|
|
error_code = "trace_config_check_error"
|
|
description = "Invalid Credentials."
|
|
code = 400
|
|
|
|
|
|
class InvokeRateLimitError(BaseHTTPException):
|
|
"""Raised when the Invoke returns rate limit error."""
|
|
|
|
error_code = "rate_limit_error"
|
|
description = "Rate Limit Error"
|
|
code = 429
|
|
|
|
|
|
class NeedAddIdsError(BaseHTTPException):
|
|
error_code = "need_add_ids"
|
|
description = "Need to add ids."
|
|
code = 400
|
|
|
|
|
|
class AppAssetNodeNotFoundError(BaseHTTPException):
|
|
error_code = "app_asset_node_not_found"
|
|
description = "App asset node not found."
|
|
code = 404
|
|
|
|
|
|
class AppAssetFileRequiredError(BaseHTTPException):
|
|
error_code = "app_asset_file_required"
|
|
description = "File is required."
|
|
code = 400
|
|
|
|
|
|
class AppAssetPathConflictError(BaseHTTPException):
|
|
error_code = "app_asset_path_conflict"
|
|
description = "Path already exists."
|
|
code = 409
|