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.

enhance: preload general packages (#3567)

Yeuolyc7de51ca9a99
diff --git a/api/core/helper/code_executor/python_transformer.py b/api/core/helper/code_executor/python_transformer.py
index ca758c1efa1..d6a13e9923a 100644
--- a/api/core/helper/code_executor/python_transformer.py
+++ b/api/core/helper/code_executor/python_transformer.py
@@ -20,8 +20,28 @@ result = f'''<<RESULT>>
print(result)
"""
-PYTHON_PRELOAD = """"""
-
+PYTHON_PRELOAD = """
+# prepare general imports
+import json
+import datetime
+import math
+import random
+import re
+import string
+import sys
+import time
+import traceback
+import uuid
+import os
+import base64
+import hashlib
+import hmac
+import binascii
+import collections
+import functools
+import operator
+import itertools
+"""
class PythonTemplateTransformer(TemplateTransformer):
@classmethod