From 9024c28e704c63e1bac54d9996f0fa93f9a6866a Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Thu, 18 May 2023 22:15:01 +0800 Subject: [PATCH] perf: fix some logs --- cores/qqbot/core.py | 6 +++--- main.py | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py index 63af5b4e..68c0a188 100644 --- a/cores/qqbot/core.py +++ b/cores/qqbot/core.py @@ -280,9 +280,6 @@ def initBot(cfg, prov): gu.log(f"QQ开放平台AppID: {cfg['qqbot']['appid']} 令牌: {cfg['qqbot']['token']}") - gu.log("\n如果有任何问题, 请在 https://github.com/Soulter/QQChannelChatGPT 上提交issue说明问题!或者添加QQ:905617992", gu.LEVEL_INFO, fg=gu.FG_COLORS['yellow']) - gu.log("请给 https://github.com/Soulter/QQChannelChatGPT 点个star!", gu.LEVEL_INFO, fg=gu.FG_COLORS['yellow']) - if chosen_provider is None: gu.log("检测到没有启动任何一个语言模型。请至少在配置文件中启用一个语言模型。", gu.LEVEL_CRITICAL) @@ -335,6 +332,9 @@ def initBot(cfg, prov): else: gocq_bot = QQ(False) + gu.log("机器人部署教程: https://github.com/Soulter/QQChannelChatGPT/wiki/", gu.LEVEL_INFO, fg=gu.FG_COLORS['yellow']) + gu.log("如果有任何问题, 请在 https://github.com/Soulter/QQChannelChatGPT 上提交issue说明问题!", gu.LEVEL_INFO, fg=gu.FG_COLORS['yellow']) + gu.log("请给 https://github.com/Soulter/QQChannelChatGPT 点个star!", gu.LEVEL_INFO, fg=gu.FG_COLORS['yellow']) # QQ频道 if 'qqbot' in cfg and cfg['qqbot']['enable']: diff --git a/main.py b/main.py index 97ea054f..9243bdab 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,10 @@ -import threading -import asyncio import os, sys from pip._internal import main as pipmain +import util.general_utils as gu abs_path = os.path.dirname(os.path.realpath(sys.argv[0])) + '/' -def main(loop, event): +def main(): try: import cores.qqbot.core as qqBot import yaml @@ -13,7 +12,7 @@ def main(loop, event): cfg = yaml.safe_load(ymlfile) except BaseException as e: print(e) - input("yaml库未导入或者配置文件格式错误,请退出程序重试。") + input("第三方依赖库未完全安装完毕,请退出程序重试。") exit() if 'http_proxy' in cfg: @@ -22,7 +21,11 @@ def main(loop, event): os.environ['HTTPS_PROXY'] = cfg['https_proxy'] provider = privider_chooser(cfg) - print('[System] 当前语言模型提供商: ' + str(provider)) + if len(provider) == 0: + gu.log("未开启任何语言模型, 请在configs/config.yaml下选择开启相应语言模型。", gu.LEVEL_CRITICAL) + input("按任意键退出...") + exit() + print('[System] 开启的语言模型: ' + str(provider)) # 执行Bot qqBot.initBot(cfg, provider) @@ -116,7 +119,4 @@ if __name__ == "__main__": except BaseException as e: print(e) print(f"[System-err] Replit Web保活服务启动失败:{str(e)}") - - bot_event = threading.Event() - loop = asyncio.get_event_loop() - main(loop, bot_event) \ No newline at end of file + main() \ No newline at end of file