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.

feat: support config max size of plugin generated files (#30887)

Bowen Liangc0ffb6db2a12
diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.py
index 3fe9031dff9..d37cff63e90 100644
--- a/api/configs/feature/__init__.py
+++ b/api/configs/feature/__init__.py
@@ -265,6 +265,11 @@ class PluginConfig(BaseSettings):
default=60 * 60,
)
+ PLUGIN_MAX_FILE_SIZE: PositiveInt = Field(
+ description="Maximum allowed size (bytes) for plugin-generated files",
+ default=50 * 1024 * 1024,
+ )
+
class MarketplaceConfig(BaseSettings):
"""
diff --git a/api/core/plugin/impl/tool.py b/api/core/plugin/impl/tool.py
index 6fa5136b423..cc38ecfce22 100644
--- a/api/core/plugin/impl/tool.py
+++ b/api/core/plugin/impl/tool.py
@@ -3,6 +3,8 @@ from typing import Any
from pydantic import BaseModel
+from configs import dify_config
+
# from core.plugin.entities.plugin import GenericProviderID, ToolProviderID
from core.plugin.entities.plugin_daemon import CredentialType, PluginBasicBooleanResponse, PluginToolProviderEntity
from core.plugin.impl.base import BasePluginClient
@@ -122,7 +124,7 @@ class PluginToolManager(BasePluginClient):
},
)
- return merge_blob_chunks(response)
+ return merge_blob_chunks(response, max_file_size=dify_config.PLUGIN_MAX_FILE_SIZE)
def validate_provider_credentials(
self, tenant_id: str, user_id: str, provider: str, credentials: dict[str, Any]
diff --git a/api/pyproject.toml b/api/pyproject.toml
index a3ea683bda7..530b0c0da3e 100644
--- a/api/pyproject.toml
+++ b/api/pyproject.toml
@@ -67,7 +67,7 @@ dependencies = [
"pycryptodome==3.23.0",
"pydantic~=2.11.4",
"pydantic-extra-types~=2.10.3",
- "pydantic-settings~=2.11.0",
+ "pydantic-settings~=2.12.0",
"pyjwt~=2.10.1",
"pypdfium2==5.2.0",
"python-docx~=1.1.0",
diff --git a/api/uv.lock b/api/uv.lock
index 03622e0ce64..afad10dc945 100644
--- a/api/uv.lock
+++ b/api/uv.lock
@@ -1635,7 +1635,7 @@ requires-dist = [
{ name = "pycryptodome", specifier = "==3.23.0" },
{ name = "pydantic", specifier = "~=2.11.4" },
{ name = "pydantic-extra-types", specifier = "~=2.10.3" },
- { name = "pydantic-settings", specifier = "~=2.11.0" },
+ { name = "pydantic-settings", specifier = "~=2.12.0" },
{ name = "pyjwt", specifier = "~=2.10.1" },
{ name = "pypdfium2", specifier = "==5.2.0" },
{ name = "python-docx", specifier = "~=1.1.0" },
@@ -4900,16 +4900,16 @@ wheels = [
[[package]]
name = "pydantic-settings"
-version = "2.11.0"
+version = "2.12.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pydantic" },
{ name = "python-dotenv" },
{ name = "typing-inspection" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/20/c5/dbbc27b814c71676593d1c3f718e6cd7d4f00652cefa24b75f7aa3efb25e/pydantic_settings-2.11.0.tar.gz", hash = "sha256:d0e87a1c7d33593beb7194adb8470fc426e95ba02af83a0f23474a04c9a08180", size = 188394, upload-time = "2025-09-24T14:19:11.764Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/43/4b/ac7e0aae12027748076d72a8764ff1c9d82ca75a7a52622e67ed3f765c54/pydantic_settings-2.12.0.tar.gz", hash = "sha256:005538ef951e3c2a68e1c08b292b5f2e71490def8589d4221b95dab00dafcfd0", size = 194184, upload-time = "2025-11-10T14:25:47.013Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/83/d6/887a1ff844e64aa823fb4905978d882a633cfe295c32eacad582b78a7d8b/pydantic_settings-2.11.0-py3-none-any.whl", hash = "sha256:fe2cea3413b9530d10f3a5875adffb17ada5c1e1bab0b2885546d7310415207c", size = 48608, upload-time = "2025-09-24T14:19:10.015Z" },
+ { url = "https://files.pythonhosted.org/packages/c1/60/5d4751ba3f4a40a6891f24eec885f51afd78d208498268c734e256fb13c4/pydantic_settings-2.12.0-py3-none-any.whl", hash = "sha256:fddb9fd99a5b18da837b29710391e945b1e30c135477f484084ee513adb93809", size = 51880, upload-time = "2025-11-10T14:25:45.546Z" },
]
[[package]]