mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-25 17:22:55 +00:00
fix: dependency package (#4328)
This commit is contained in:
parent
bba5f9b3d6
commit
0b330c82db
|
|
@ -6,16 +6,36 @@
|
|||
@date:2025/11/5 15:14
|
||||
@desc:
|
||||
"""
|
||||
import builtins
|
||||
import os
|
||||
import sys
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
|
||||
class TorchBlocker:
|
||||
def __init__(self):
|
||||
self.original_import = builtins.__import__
|
||||
|
||||
def __call__(self, name, *args, **kwargs):
|
||||
if len([True for i in
|
||||
['torch']
|
||||
if
|
||||
i in name.lower()]) > 0:
|
||||
print(f"Disable package is being imported: 【{name}】", file=sys.stderr)
|
||||
pass
|
||||
else:
|
||||
return self.original_import(name, *args, **kwargs)
|
||||
|
||||
|
||||
# 安装导入拦截器
|
||||
builtins.__import__ = TorchBlocker()
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'maxkb.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
||||
|
||||
|
||||
def post_handler():
|
||||
from common.database_model_manage.database_model_manage import DatabaseModelManage
|
||||
from common import event
|
||||
|
|
@ -29,9 +49,10 @@ def post_scheduler_handler():
|
|||
|
||||
job.run()
|
||||
|
||||
|
||||
# 启动后处理函数
|
||||
post_handler()
|
||||
|
||||
# 仅在scheduler中启动定时任务,dev local_model celery 不需要
|
||||
if os.environ.get('ENABLE_SCHEDULER') == '1':
|
||||
post_scheduler_handler()
|
||||
post_scheduler_handler()
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ dependencies = [
|
|||
"langchain-huggingface==0.3.0",
|
||||
"langchain-ollama==0.3.4",
|
||||
"langgraph==0.5.3",
|
||||
"langchain_core==0.3.74",
|
||||
"torch==2.8.0",
|
||||
"sentence-transformers==5.0.0",
|
||||
"qianfan==0.4.12.3",
|
||||
|
|
|
|||
Loading…
Reference in New Issue