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.

fix: allow None values in VariableMessage validation (#30082)

倉嶋 将矢a26b2d74d4c2
diff --git a/api/core/tools/entities/tool_entities.py b/api/core/tools/entities/tool_entities.py
index 353f3a646a9..583a3584f79 100644
--- a/api/core/tools/entities/tool_entities.py
+++ b/api/core/tools/entities/tool_entities.py
@@ -153,11 +153,11 @@ class ToolInvokeMessage(BaseModel):
@classmethod
def transform_variable_value(cls, values):
"""
- Only basic types and lists are allowed.
+ Only basic types, lists, and None are allowed.
"""
value = values.get("variable_value")
- if not isinstance(value, dict | list | str | int | float | bool):
- raise ValueError("Only basic types and lists are allowed.")
+ if value is not None and not isinstance(value, dict | list | str | int | float | bool):
+ raise ValueError("Only basic types, lists, and None are allowed.")
# if stream is true, the value must be a string
if values.get("stream"):