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: handle numpy scalar types in safe_json_value (#35389)

Avasis AI0d921cd21ddd
diff --git a/api/core/tools/utils/message_transformer.py b/api/core/tools/utils/message_transformer.py
index 79d0c114d4d..5679466cbcb 100644
--- a/api/core/tools/utils/message_transformer.py
+++ b/api/core/tools/utils/message_transformer.py
@@ -41,6 +41,10 @@ def safe_json_value(v):
return v.hex()
elif isinstance(v, memoryview):
return v.tobytes().hex()
+ elif isinstance(v, np.integer):
+ return int(v)
+ elif isinstance(v, np.floating):
+ return float(v)
elif isinstance(v, np.ndarray):
return v.tolist()
elif isinstance(v, dict):