mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 19:37:36 +08:00
perf: 简化启动时输出
This commit is contained in:
5
main.py
5
main.py
@@ -90,13 +90,12 @@ def load_config():
|
|||||||
|
|
||||||
if not is_integrity:
|
if not is_integrity:
|
||||||
logging.warning("以下配置字段不存在: {}".format(", ".join(non_exist_keys)))
|
logging.warning("以下配置字段不存在: {}".format(", ".join(non_exist_keys)))
|
||||||
logging.warning("配置文件不完整,您可以依据config-template.py检查config.py")
|
|
||||||
|
|
||||||
# 检查override.json覆盖
|
# 检查override.json覆盖
|
||||||
override_config()
|
override_config()
|
||||||
|
|
||||||
if not is_integrity:
|
if not is_integrity:
|
||||||
logging.warning("以上不存在的配置已被设为默认值,将在3秒后继续启动... ")
|
logging.warning("以上不存在的配置已被设为默认值,您可以依据config-template.py检查config.py,将在3秒后继续启动... ")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
# 存进上下文
|
# 存进上下文
|
||||||
@@ -226,7 +225,7 @@ def start(first_time_init=False):
|
|||||||
def run_bot_wrapper():
|
def run_bot_wrapper():
|
||||||
global known_exception_caught
|
global known_exception_caught
|
||||||
try:
|
try:
|
||||||
logging.info("使用账号: {}".format(qqbot.bot_account_id))
|
logging.debug("使用账号: {}".format(qqbot.bot_account_id))
|
||||||
qqbot.adapter.run_sync()
|
qqbot.adapter.run_sync()
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
if str(e).__contains__("argument 'debug'"):
|
if str(e).__contains__("argument 'debug'"):
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class OpenAIInteract:
|
|||||||
self.key_mgr = pkg.openai.keymgr.KeysManager(api_key)
|
self.key_mgr = pkg.openai.keymgr.KeysManager(api_key)
|
||||||
self.audit_mgr = pkg.audit.gatherer.DataGatherer()
|
self.audit_mgr = pkg.audit.gatherer.DataGatherer()
|
||||||
|
|
||||||
logging.info("文字总使用量:%d", self.audit_mgr.get_total_text_length())
|
# logging.info("文字总使用量:%d", self.audit_mgr.get_total_text_length())
|
||||||
|
|
||||||
openai.api_key = self.key_mgr.get_using_key()
|
openai.api_key = self.key_mgr.get_using_key()
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def load_sessions():
|
|||||||
session_data = db_inst.load_valid_sessions()
|
session_data = db_inst.load_valid_sessions()
|
||||||
|
|
||||||
for session_name in session_data:
|
for session_name in session_data:
|
||||||
logging.info('加载session: {}'.format(session_name))
|
logging.debug('加载session: {}'.format(session_name))
|
||||||
|
|
||||||
temp_session = Session(session_name)
|
temp_session = Session(session_name)
|
||||||
temp_session.name = session_name
|
temp_session.name = session_name
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def walk_plugin_path(module, prefix='', path_prefix=''):
|
|||||||
|
|
||||||
def load_plugins():
|
def load_plugins():
|
||||||
"""加载插件"""
|
"""加载插件"""
|
||||||
logging.info("加载插件")
|
logging.debug("加载插件")
|
||||||
PluginHost()
|
PluginHost()
|
||||||
walk_plugin_path(__import__('plugins'))
|
walk_plugin_path(__import__('plugins'))
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class QQBotManager:
|
|||||||
# 故只在第一次初始化时创建bot对象,重载之后使用原bot对象
|
# 故只在第一次初始化时创建bot对象,重载之后使用原bot对象
|
||||||
# 因此,bot的配置不支持热重载
|
# 因此,bot的配置不支持热重载
|
||||||
if first_time_init:
|
if first_time_init:
|
||||||
logging.info("Use adapter:" + config.msg_source_adapter)
|
logging.debug("Use adapter:" + config.msg_source_adapter)
|
||||||
if config.msg_source_adapter == 'yirimirai':
|
if config.msg_source_adapter == 'yirimirai':
|
||||||
from pkg.qqbot.sources.yirimirai import YiriMiraiAdapter
|
from pkg.qqbot.sources.yirimirai import YiriMiraiAdapter
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user