diff --git a/src/plugins/memory_system/draw_memory.py b/src/plugins/memory_system/draw_memory.py index ffe2ba42..9f15164f 100644 --- a/src/plugins/memory_system/draw_memory.py +++ b/src/plugins/memory_system/draw_memory.py @@ -9,7 +9,10 @@ import networkx as nx from dotenv import load_dotenv from loguru import logger -sys.path.append("C:/GitHub/MaiMBot") # 添加项目根目录到 Python 路径 +# 添加项目根目录到 Python 路径 +root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) +sys.path.append(root_path) + from src.common.database import Database # 使用正确的导入语法 # 加载.env.dev文件 diff --git a/src/plugins/memory_system/memory_manual_build.py b/src/plugins/memory_system/memory_manual_build.py index 3a2961b6..9c1d43ce 100644 --- a/src/plugins/memory_system/memory_manual_build.py +++ b/src/plugins/memory_system/memory_manual_build.py @@ -16,7 +16,10 @@ from loguru import logger import jieba # from chat.config import global_config -sys.path.append("C:/GitHub/MaiMBot") # 添加项目根目录到 Python 路径 +# 添加项目根目录到 Python 路径 +root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) +sys.path.append(root_path) + from src.common.database import Database from src.plugins.memory_system.offline_llm import LLMModel