mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
refactor: 指令注册架构
This commit is contained in:
13
main.py
13
main.py
@@ -7,6 +7,7 @@ import time
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import colorlog
|
||||
@@ -191,8 +192,14 @@ def start(first_time_init=False):
|
||||
import pkg.openai.session
|
||||
import pkg.qqbot.manager
|
||||
import pkg.openai.dprompt
|
||||
import pkg.qqbot.cmds.mgr
|
||||
|
||||
pkg.openai.dprompt.register_all()
|
||||
try:
|
||||
pkg.openai.dprompt.register_all()
|
||||
pkg.qqbot.cmds.mgr.register_all()
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
traceback.print_exc()
|
||||
|
||||
# 配置openai api_base
|
||||
if "reverse_proxy" in config.openai_config and config.openai_config["reverse_proxy"] is not None:
|
||||
@@ -271,10 +278,6 @@ def start(first_time_init=False):
|
||||
threading.Thread(
|
||||
target=run_bot_wrapper
|
||||
).start()
|
||||
# 机器人暂时不能放在线程池中
|
||||
# pkg.utils.context.get_thread_ctl().submit_sys_task(
|
||||
# run_bot_wrapper
|
||||
# )
|
||||
finally:
|
||||
# 判断若是Windows,输出选择模式可能会暂停程序的警告
|
||||
if os.name == 'nt':
|
||||
|
||||
Reference in New Issue
Block a user