From f5edefebb42fb4c3f4b477b5516040b5120cb5dc Mon Sep 17 00:00:00 2001 From: NepPure Date: Fri, 28 Feb 2025 21:13:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=8A=A0=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/schedule/schedule_generator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/schedule/schedule_generator.py b/src/plugins/schedule/schedule_generator.py index eedc7dbf0..665871518 100644 --- a/src/plugins/schedule/schedule_generator.py +++ b/src/plugins/schedule/schedule_generator.py @@ -11,6 +11,12 @@ from ...common.database import Database # 使用正确的导入语法 # from src.plugins.schedule.schedule_llm_module import LLMModel # from src.common.database import Database # 使用正确的导入语法 +# 获取当前文件的绝对路径 +#TODO: 这个好几个地方用需要封装 +current_dir = os.path.dirname(os.path.abspath(__file__)) +root_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) +load_dotenv(os.path.join(root_dir, '.env')) + Database.initialize( host= os.getenv("MONGODB_HOST"), port= int(os.getenv("MONGODB_PORT")),