Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

2.9 KB
Raw Blame
from libs.exception import BaseHTTPException
from services.knowledge_fs.product_dto import (
    KnowledgeFSUpgradeModelErrorDetailsResponse,
    KnowledgeFSUpgradeModelIssueResponse,
)


class DatasetNotInitializedError(BaseHTTPException):
    error_code = "dataset_not_initialized"
    description = "The dataset is still being initialized or indexing. Please wait a moment."
    code = 400


class KnowledgeFSUpgradeModelsUnavailableHTTPError(BaseHTTPException):
    error_code = "knowledge_fs_upgrade_models_unavailable"
    description = "One or more selected upgrade models are unavailable."
    code = 422
    details_model = KnowledgeFSUpgradeModelErrorDetailsResponse

    def __init__(self, issues: list[KnowledgeFSUpgradeModelIssueResponse]) -> None:
        super().__init__()
        assert self.data is not None
        self.data["details"] = KnowledgeFSUpgradeModelErrorDetailsResponse(issues=issues).model_dump(mode="json")


class ArchivedDocumentImmutableError(BaseHTTPException):
    error_code = "archived_document_immutable"
    description = "The archived document is not editable."
    code = 403


class DatasetNameDuplicateError(BaseHTTPException):
    error_code = "dataset_name_duplicate"
    description = "The dataset name already exists. Please modify your dataset name."
    code = 409


class InvalidActionError(BaseHTTPException):
    error_code = "invalid_action"
    description = "Invalid action."
    code = 400


class DatasetAccessDeniedRequestError(BaseHTTPException):
    error_code = "dataset_access_denied"
    description = "Dataset access denied."
    code = 403


class DocumentAlreadyFinishedError(BaseHTTPException):
    error_code = "document_already_finished"
    description = "The document has been processed. Please refresh the page or go to the document details."
    code = 400


class DocumentIndexingError(BaseHTTPException):
    error_code = "document_indexing"
    description = "The document is being processed and cannot be edited."
    code = 400


class InvalidMetadataError(BaseHTTPException):
    error_code = "invalid_metadata"
    description = "The metadata content is incorrect. Please check and verify."
    code = 400


class WebsiteCrawlError(BaseHTTPException):
    error_code = "crawl_failed"
    description = "{message}"
    code = 500


class IndexingEstimateError(BaseHTTPException):
    error_code = "indexing_estimate_error"
    description = "Knowledge indexing estimate failed: {message}"
    code = 500


class ChildChunkIndexingError(BaseHTTPException):
    error_code = "child_chunk_indexing_error"
    description = "Create child chunk index failed: {message}"
    code = 500


class ChildChunkDeleteIndexError(BaseHTTPException):
    error_code = "child_chunk_delete_index_error"
    description = "Delete child chunk index failed: {message}"
    code = 500


class PipelineNotFoundError(BaseHTTPException):
    error_code = "pipeline_not_found"
    description = "Pipeline not found."
    code = 404