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
fix: fix file number limit error (#17848)
Good Woodcc08451eb874
diff --git a/api/constants/__init__.py b/api/constants/__init__.pyindex b5dfd9cb183..91623574663 100644--- a/api/constants/__init__.py+++ b/api/constants/__init__.py@@ -3,6 +3,8 @@ from configs import dify_configHIDDEN_VALUE = "[__HIDDEN__]"UUID_NIL = "00000000-0000-0000-0000-000000000000"+DEFAULT_FILE_NUMBER_LIMITS = 3+IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "webp", "gif", "svg"]IMAGE_EXTENSIONS.extend([ext.upper() for ext in IMAGE_EXTENSIONS])diff --git a/api/controllers/common/helpers.py b/api/controllers/common/helpers.pyindex 2979375169b..282708c037f 100644--- a/api/controllers/common/helpers.py+++ b/api/controllers/common/helpers.py@@ -10,6 +10,8 @@ from uuid import uuid4import httpx+from constants import DEFAULT_FILE_NUMBER_LIMITS+try:import magicexcept ImportError:@@ -108,7 +110,7 @@ def get_parameters_from_feature_dict(*, features_dict: Mapping[str, Any], user_i{"image": {"enabled": False,- "number_limits": 3,+ "number_limits": DEFAULT_FILE_NUMBER_LIMITS,"detail": "high","transfer_methods": ["remote_url", "local_file"],}diff --git a/api/core/app/app_config/features/file_upload/manager.py b/api/core/app/app_config/features/file_upload/manager.pyindex bcc69e8ec60..40b6c192147 100644--- a/api/core/app/app_config/features/file_upload/manager.py+++ b/api/core/app/app_config/features/file_upload/manager.py@@ -1,6 +1,7 @@from collections.abc import Mappingfrom typing import Any+from constants import DEFAULT_FILE_NUMBER_LIMITSfrom core.file import FileUploadConfig@@ -18,7 +19,7 @@ class FileUploadConfigManager:if file_upload_dict.get("enabled"):transform_methods = file_upload_dict.get("allowed_file_upload_methods", [])file_upload_dict["image_config"] = {- "number_limits": file_upload_dict.get("number_limits", 1),+ "number_limits": file_upload_dict.get("number_limits", DEFAULT_FILE_NUMBER_LIMITS),"transfer_methods": transform_methods,}diff --git a/api/models/model.py b/api/models/model.pyindex 8262109ba5e..dfc1322d926 100644--- a/api/models/model.py+++ b/api/models/model.py@@ -23,6 +23,7 @@ from sqlalchemy import Float, Index, PrimaryKeyConstraint, func, textfrom sqlalchemy.orm import Mapped, Session, mapped_columnfrom configs import dify_config+from constants import DEFAULT_FILE_NUMBER_LIMITSfrom core.file import FILE_MODEL_IDENTITY, File, FileTransferMethod, FileTypefrom core.file import helpers as file_helpersfrom core.file.tool_file_parser import ToolFileParser@@ -442,7 +443,7 @@ class AppModelConfig(Base):else {"image": {"enabled": False,- "number_limits": 3,+ "number_limits": DEFAULT_FILE_NUMBER_LIMITS,"detail": "high","transfer_methods": ["remote_url", "local_file"],}diff --git a/api/models/workflow.py b/api/models/workflow.pyindex dbcb859823a..8b7c376e4be 100644--- a/api/models/workflow.py+++ b/api/models/workflow.py@@ -15,7 +15,7 @@ from sqlalchemy import Index, PrimaryKeyConstraint, funcfrom sqlalchemy.orm import Mapped, mapped_columnimport contexts-from constants import HIDDEN_VALUE+from constants import DEFAULT_FILE_NUMBER_LIMITS, HIDDEN_VALUEfrom core.helper import encrypterfrom core.variables import SecretVariable, Variablefrom factories import variable_factory@@ -186,7 +186,7 @@ class Workflow(Base):features = json.loads(self._features)if features.get("file_upload", {}).get("image", {}).get("enabled", False):image_enabled = True- image_number_limits = int(features["file_upload"]["image"].get("number_limits", 1))+ image_number_limits = int(features["file_upload"]["image"].get("number_limits", DEFAULT_FILE_NUMBER_LIMITS))image_transfer_methods = features["file_upload"]["image"].get("transfer_methods", ["remote_url", "local_file"])