refactor: 重构代码结构和导入路径

fix(ws): 修复反向WebSocket管理器中的循环导入问题
docs: 删除不再使用的文档文件
style: 统一模型导入路径为neobot.models
chore: 更新配置文件中的API密钥和连接地址
This commit is contained in:
aakiscool1314
2026-03-27 14:14:09 +08:00
parent 7106bf65da
commit ec8d7259f5
23 changed files with 90 additions and 371 deletions

13
main.py
View File

@@ -10,6 +10,11 @@ import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
# 将 src 目录添加到 sys.path必须在导入 neobot 模块之前执行)
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.join(ROOT_DIR, "src")
sys.path.insert(0, SRC_DIR)
# 初始化日志系统,必须在其他 neobot 模块导入之前执行
from neobot.core.utils.logger import logger
@@ -24,12 +29,6 @@ from neobot.core.services.local_file_server import start_local_file_server, stop
from neobot.adapters.discord_adapter import DiscordAdapter
# 将项目根目录添加到 sys.path
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, ROOT_DIR)
# 获取插件目录的绝对路径
PLUGIN_DIR = os.path.join(ROOT_DIR, "src", "neobot", "plugins")
@@ -154,7 +153,7 @@ async def main():
# 启动文件监控
# 监控 plugins 目录
plugin_path = os.path.join(os.path.dirname(__file__), "src", "neobot", "plugins")
plugin_path = os.path.join(ROOT_DIR, "src", "neobot", "plugins")
# 获取当前事件循环并传递给处理器
loop = asyncio.get_running_loop()