fix: 使用动态路径替换硬编码的项目路径

将内存系统相关文件中硬编码的项目路径(C:/GitHub/MaiMBot)替换为动态计算的相对路径,
提高代码的可移植性和兼容性。

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
春河晴
2025-03-10 15:51:39 +09:00
parent 8ff7bb6f88
commit ed505a4c11
2 changed files with 8 additions and 2 deletions

View File

@@ -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文件

View File

@@ -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