Skip to content

Commit 2cf01dd

Browse files
committed
refactor: remove license validation message for community version knowledge bases
1 parent 94847bb commit 2cf01dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/common/utils/tool_code.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import os
44
import subprocess
55
import sys
6-
import uuid_utils.compat as uuid
76
from textwrap import dedent
87

8+
import uuid_utils.compat as uuid
99
from diskcache import Cache
1010

11-
from maxkb.const import BASE_DIR
11+
from maxkb.const import BASE_DIR, CONFIG
1212
from maxkb.const import PROJECT_DIR
1313

1414
python_directory = sys.executable
@@ -39,14 +39,14 @@ def exec_code(self, code_str, keywords):
3939
success = '{"code":200,"msg":"成功","data":exec_result}'
4040
err = '{"code":500,"msg":str(e),"data":None}'
4141
path = r'' + self.sandbox_path + ''
42+
python_paths = CONFIG.get_sandbox_python_package_paths().split(',')
4243
_exec_code = f"""
4344
try:
4445
import os
4546
import sys
4647
path_to_exclude = ['/opt/py3/lib/python3.11/site-packages', '/opt/maxkb-app/apps']
4748
sys.path = [p for p in sys.path if p not in path_to_exclude]
48-
sys.path.append('/opt/maxkb-app/sandbox/python-packages')
49-
sys.path.append('/opt/maxkb/python-packages')
49+
sys.path += {python_paths}
5050
env = dict(os.environ)
5151
for key in list(env.keys()):
5252
if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG')):

0 commit comments

Comments
 (0)