refactor(service): handle unsupported DSL version with warning (#10151)

This commit is contained in:
-LAN-
2024-11-01 15:04:54 +08:00
committed by GitHub
parent 8d5456b6d0
commit 951308b5f3
2 changed files with 9 additions and 2 deletions

View File

@@ -16,7 +16,6 @@ from services.workflow_service import WorkflowService
from .exc import (
ContentDecodingError,
DSLVersionNotSupportedError,
EmptyContentError,
FileSizeLimitExceededError,
InvalidAppModeError,
@@ -472,11 +471,13 @@ def _check_or_fix_dsl(import_data: dict[str, Any]) -> Mapping[str, Any]:
imported_version = import_data.get("version")
if imported_version != current_dsl_version:
if imported_version and version.parse(imported_version) > version.parse(current_dsl_version):
raise DSLVersionNotSupportedError(
errmsg = (
f"The imported DSL version {imported_version} is newer than "
f"the current supported version {current_dsl_version}. "
f"Please upgrade your Dify instance to import this configuration."
)
logger.warning(errmsg)
# raise DSLVersionNotSupportedError(errmsg)
else:
logger.warning(
f"DSL version {imported_version} is older than "