init: 消息问答助手 — 微信/QQ监控 + 本地知识库搜索 + GUI
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""消息问答助手 — 入口"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
# 确保在项目目录
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# 配置日志
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s [%(name)s] %(levelname)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
)
|
||||
|
||||
logger = logging.getLogger("msgbot")
|
||||
|
||||
|
||||
def main():
|
||||
logger.info("消息问答助手启动中...")
|
||||
|
||||
# 动态导入 gui,避免 customtkinter 等缺失导致整个程序崩溃前无日志
|
||||
try:
|
||||
from gui import MsgBotApp
|
||||
except ImportError as e:
|
||||
logger.error(f"导入 GUI 失败: {e}")
|
||||
logger.error("请先安装依赖: pip install -r requirements.txt")
|
||||
sys.exit(1)
|
||||
|
||||
app = MsgBotApp()
|
||||
app.mainloop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user