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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: remove unnecessary type conversions (#41454)
lin1264d29a4fec
diff --git a/api/controllers/console/app/app.py b/api/controllers/console/app/app.pyindex af1d9d6c971..358fd60c0fe 100644--- a/api/controllers/console/app/app.py+++ b/api/controllers/console/app/app.py@@ -642,13 +642,13 @@ class AppListApi(Resource):)permissions = enterprise_rbac_service.RBACService.MyPermissions.get(- str(current_tenant_id),+ current_tenant_id,current_user_id,session=session,)if dify_config.RBAC_ENABLED:access_filter = resolve_app_access_filter(- str(current_tenant_id),+ current_tenant_id,current_user_id,session=session,permissions=permissions,@@ -675,7 +675,7 @@ class AppListApi(Resource):pagination_model = pagination_model.model_copy(update={"data": [- item.model_copy(update={"permission_keys": permission_keys_map.get(str(item.id), [])})+ item.model_copy(update={"permission_keys": permission_keys_map.get(item.id, [])})for item in pagination_model.data]}@@ -712,7 +712,7 @@ class AppListApi(Resource):app_service = AppService()app = app_service.create_app(current_tenant_id, params, current_user, session=session)permission_keys_map = enterprise_rbac_service.RBACService.AppPermissions.batch_get(- str(current_tenant_id),+ current_tenant_id,current_user.id,[str(app.id)],session=session,@@ -882,7 +882,7 @@ class AppApi(Resource):app_model.access_mode = app_setting.access_modepermissions = enterprise_rbac_service.RBACService.MyPermissions.get(- str(current_tenant_id),+ current_tenant_id,current_user.id,app_id=str(app_model.id),session=session,@@ -1020,7 +1020,7 @@ class AppCopyApi(Resource):raise NotFound("App not found")permission_keys_map = enterprise_rbac_service.RBACService.AppPermissions.batch_get(- str(current_tenant_id),+ current_tenant_id,current_user.id,[str(app.id)],session=session,@@ -1088,7 +1088,7 @@ class AppPublishToCreatorsPlatformApi(Resource):# TODO: Move this configuration and OAuth orchestration into the Creators Platform application service# when that domain is refactored. This controller-level integration is a temporary compatibility bridge.oauth_code = None- client_id = str(dify_config.CREATORS_PLATFORM_OAUTH_CLIENT_ID or "")+ client_id = dify_config.CREATORS_PLATFORM_OAUTH_CLIENT_ID or ""if client_id:authorization = application_services().oauth_server.issue_authorization_code(client_id=client_id,diff --git a/api/controllers/console/auth/error.py b/api/controllers/console/auth/error.pyindex daf7b344bee..af34860d5ec 100644--- a/api/controllers/console/auth/error.py+++ b/api/controllers/console/auth/error.py@@ -55,7 +55,7 @@ class PasswordResetRateLimitExceededError(BaseHTTPException):code = 429def __init__(self, minutes: int = 1):- description = self.description.format(minutes=int(minutes)) if self.description else None+ description = self.description.format(minutes=minutes) if self.description else Nonesuper().__init__(description=description)@@ -65,7 +65,7 @@ class EmailRegisterRateLimitExceededError(BaseHTTPException):code = 429def __init__(self, minutes: int = 1):- description = self.description.format(minutes=int(minutes)) if self.description else None+ description = self.description.format(minutes=minutes) if self.description else Nonesuper().__init__(description=description)@@ -75,7 +75,7 @@ class EmailChangeRateLimitExceededError(BaseHTTPException):code = 429def __init__(self, minutes: int = 1):- description = self.description.format(minutes=int(minutes)) if self.description else None+ description = self.description.format(minutes=minutes) if self.description else Nonesuper().__init__(description=description)@@ -85,7 +85,7 @@ class OwnerTransferRateLimitExceededError(BaseHTTPException):code = 429def __init__(self, minutes: int = 1):- description = self.description.format(minutes=int(minutes)) if self.description else None+ description = self.description.format(minutes=minutes) if self.description else Nonesuper().__init__(description=description)@@ -137,7 +137,7 @@ class EmailCodeLoginRateLimitExceededError(BaseHTTPException):code = 429def __init__(self, minutes: int = 5):- description = self.description.format(minutes=int(minutes)) if self.description else None+ description = self.description.format(minutes=minutes) if self.description else Nonesuper().__init__(description=description)@@ -147,7 +147,7 @@ class EmailCodeAccountDeletionRateLimitExceededError(BaseHTTPException):code = 429def __init__(self, minutes: int = 5):- description = self.description.format(minutes=int(minutes)) if self.description else None+ description = self.description.format(minutes=minutes) if self.description else Nonesuper().__init__(description=description)diff --git a/api/controllers/console/workspace/snippets.py b/api/controllers/console/workspace/snippets.pyindex f5e2f85a0b7..ba1b3d816b3 100644--- a/api/controllers/console/workspace/snippets.py+++ b/api/controllers/console/workspace/snippets.py@@ -221,7 +221,7 @@ class CustomizedSnippetDetailApi(Resource):"""Update customized snippet."""snippet_service = _snippet_service()snippet = snippet_service.get_snippet_by_id(- snippet_id=str(snippet_id),+ snippet_id=snippet_id,tenant_id=current_tenant_id,)@@ -265,7 +265,7 @@ class CustomizedSnippetDetailApi(Resource):"""Delete customized snippet."""snippet_service = _snippet_service()snippet = snippet_service.get_snippet_by_id(- snippet_id=str(snippet_id),+ snippet_id=snippet_id,tenant_id=current_tenant_id,)@@ -304,7 +304,7 @@ class CustomizedSnippetExportApi(Resource):"""Export snippet as DSL."""snippet_service = _snippet_service()snippet = snippet_service.get_snippet_by_id(- snippet_id=str(snippet_id),+ snippet_id=snippet_id,tenant_id=current_tenant_id,)@@ -428,7 +428,7 @@ class CustomizedSnippetCheckDependenciesApi(Resource):"""Check dependencies for a snippet."""snippet_service = _snippet_service()snippet = snippet_service.get_snippet_by_id(- snippet_id=str(snippet_id),+ snippet_id=snippet_id,tenant_id=current_tenant_id,)@@ -458,7 +458,7 @@ class CustomizedSnippetUseCountIncrementApi(Resource):"""Increment snippet use count when it is inserted into a workflow."""snippet_service = _snippet_service()snippet = snippet_service.get_snippet_by_id(- snippet_id=str(snippet_id),+ snippet_id=snippet_id,tenant_id=current_tenant_id,)diff --git a/api/core/workflow/generator/runner.py b/api/core/workflow/generator/runner.pyindex a0fa6e3f500..42095fbf85c 100644--- a/api/core/workflow/generator/runner.py+++ b/api/core/workflow/generator/runner.py@@ -1193,7 +1193,7 @@ class WorkflowGenerator:if node.get("node_type") == BuiltinNodeTypes.TOOL and node.get("id")}for node in graph.get("nodes") or []:- planned = planned_by_id.get(str(node.get("id") or ""))+ planned = planned_by_id.get(node.get("id") or "")if planned is None:continuedata = node.get("data")diff --git a/api/services/annotation_service.py b/api/services/annotation_service.pyindex 087bbd9be2b..ac0de983eb9 100644--- a/api/services/annotation_service.py+++ b/api/services/annotation_service.py@@ -120,7 +120,7 @@ class AppAnnotationService:raw_message_id = args.get("message_id")if raw_message_id:- message_id = str(raw_message_id)+ message_id = raw_message_idmessage = session.scalar(select(Message).where(Message.id == message_id, Message.app_id == app.id).limit(1))if not message:@@ -176,19 +176,19 @@ class AppAnnotationService:@classmethoddef enable_app_annotation(cls, args: EnableAnnotationArgs, app_id: str) -> AnnotationJobStatusDict:- enable_app_annotation_key = f"enable_app_annotation_{str(app_id)}"+ enable_app_annotation_key = f"enable_app_annotation_{app_id}"cache_result = redis_client.get(enable_app_annotation_key)if cache_result is not None:return {"job_id": cache_result, "job_status": "processing"}# async jobjob_id = str(uuid.uuid4())- enable_app_annotation_job_key = f"enable_app_annotation_job_{str(job_id)}"+ enable_app_annotation_job_key = f"enable_app_annotation_job_{job_id}"# send batch add segments taskredis_client.setnx(enable_app_annotation_job_key, "waiting")current_user, current_tenant_id = current_account_with_tenant()enable_annotation_reply_task.delay(- str(job_id),+ job_id,app_id,current_user.id,current_tenant_id,@@ -201,17 +201,17 @@ class AppAnnotationService:@classmethoddef disable_app_annotation(cls, app_id: str) -> AnnotationJobStatusDict:_, current_tenant_id = current_account_with_tenant()- disable_app_annotation_key = f"disable_app_annotation_{str(app_id)}"+ disable_app_annotation_key = f"disable_app_annotation_{app_id}"cache_result = redis_client.get(disable_app_annotation_key)if cache_result is not None:return {"job_id": cache_result, "job_status": "processing"}# async jobjob_id = str(uuid.uuid4())- disable_app_annotation_job_key = f"disable_app_annotation_job_{str(job_id)}"+ disable_app_annotation_job_key = f"disable_app_annotation_job_{job_id}"# send batch add segments taskredis_client.setnx(disable_app_annotation_job_key, "waiting")- disable_annotation_reply_task.delay(str(job_id), app_id, current_tenant_id)+ disable_annotation_reply_task.delay(job_id, app_id, current_tenant_id)return {"job_id": job_id, "job_status": "waiting"}@classmethod@@ -539,7 +539,7 @@ class AppAnnotationService:raise ValueError("The number of annotations exceeds the limit of your subscription.")# async jobjob_id = str(uuid.uuid4())- indexing_cache_key = f"app_annotation_batch_import_{str(job_id)}"+ indexing_cache_key = f"app_annotation_batch_import_{job_id}"# Register job in active tasks list for concurrency trackingcurrent_time = int(naive_utc_now().timestamp() * 1000)@@ -549,7 +549,7 @@ class AppAnnotationService:# Set job statusredis_client.setnx(indexing_cache_key, "waiting")- batch_import_annotations_task.delay(str(job_id), result, app_id, current_tenant_id, current_user.id)+ batch_import_annotations_task.delay(job_id, result, app_id, current_tenant_id, current_user.id)except ValueError as e:return {"error_msg": str(e)}diff --git a/api/services/dataset_service.py b/api/services/dataset_service.pyindex 004e927b675..7a862478066 100644--- a/api/services/dataset_service.py+++ b/api/services/dataset_service.py@@ -1664,7 +1664,7 @@ class DocumentService:"""Fetch documents for a dataset in a single batch query."""if not document_ids:return []- document_id_list: list[str] = [str(document_id) for document_id in document_ids]+ document_id_list: list[str] = list(document_ids)# Fetch all requested documents in one query to avoid N+1 lookups.documents: Sequence[Document] = session.scalars(select(Document).where(@@ -1700,7 +1700,7 @@ class DocumentService:if not document_ids:return 0- document_id_list: list[str] = [str(document_id) for document_id in document_ids]+ document_id_list: list[str] = list(document_ids)result = session.execute(update(Document)@@ -1861,7 +1861,7 @@ class DocumentService:"""Batch load upload files keyed by document id for ZIP downloads."""- document_id_list: list[str] = [str(document_id) for document_id in document_ids]+ document_id_list: list[str] = list(document_ids)documents = DocumentService.get_documents_by_ids(DatasetRef(tenant_id=tenant_id, dataset_id=dataset_id), document_id_list, session