Refactor configuration and enhance AI capabilities

Updated .env.example to improve clarity and added new configuration options for memory and reliability settings. Refactored main.py to streamline the bot's entry point and improved error handling. Enhanced README to reflect new features and command structure. Removed deprecated cmd_zip_skill and skills_creator modules to clean up the codebase. Updated AIClient and MemorySystem for better performance and flexibility in handling user interactions.
This commit is contained in:
Mimikko-zeus
2026-03-03 21:56:33 +08:00
parent 726d41ad79
commit a754e7843f
72 changed files with 1607 additions and 5015 deletions

41
main.py
View File

@@ -1,10 +1,12 @@
"""
QQ机器人主入口
Project entrypoint.
"""
from __future__ import annotations
import sys
from pathlib import Path
# 添加项目根目录到Python路径
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
@@ -23,10 +25,6 @@ def _sqlite_supports_trigram(sqlite_module) -> bool:
def _ensure_sqlite_for_chroma():
"""
Ensure sqlite runtime supports FTS5 trigram tokenizer for Chroma.
On some cloud images, system sqlite lacks trigram support.
"""
try:
import sqlite3
except Exception:
@@ -55,35 +53,8 @@ def _ensure_sqlite_for_chroma():
_ensure_sqlite_for_chroma()
from src.core.bot import MyClient, build_intents
from src.core.config import Config
from src.utils.logger import setup_logger
def main():
"""主函数"""
# 设置日志
logger = setup_logger()
try:
# 验证配置
Config.validate()
logger.info("配置验证通过")
# 创建并启动机器人(最小权限,避免 4014 disallowed intents
logger.info("正在启动QQ机器人...")
intents = build_intents()
client = MyClient(intents=intents)
client.run(appid=Config.BOT_APPID, secret=Config.BOT_SECRET)
except ValueError as e:
logger.error(f"配置错误: {e}")
logger.error("请检查 .env 文件配置")
sys.exit(1)
except Exception as e:
logger.error(f"启动失败: {e}", exc_info=True)
sys.exit(1)
from src.core.bot import main as run_bot_main
if __name__ == "__main__":
main()
run_bot_main()