refactor: 适配配置管理器读取方式

This commit is contained in:
RockChinQ
2023-11-26 23:58:06 +08:00
parent 549a7eff7f
commit 3e17bbb90f
20 changed files with 147 additions and 112 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import logging
import mirai
from .. import aamgr
import config
from ....utils import context
@aamgr.AbstractCommandNode.register(
@@ -30,8 +30,8 @@ class DrawCommand(aamgr.AbstractCommandNode):
logging.debug("draw_image result:{}".format(res))
reply = [mirai.Image(url=res['data'][0]['url'])]
if not (hasattr(config, 'include_image_description')
and not config.include_image_description):
config = context.get_config_manager().data
if config['include_image_description']:
reply.append(" ".join(ctx.params))
return True, reply
+5 -2
View File
@@ -1,4 +1,6 @@
from .. import aamgr
from ....utils import context
@aamgr.AbstractCommandNode.register(
parent=None,
@@ -15,12 +17,13 @@ class DefaultCommand(aamgr.AbstractCommandNode):
session_name = ctx.session_name
params = ctx.params
reply = []
import config
config = context.get_config_manager().data
if len(params) == 0:
# 输出目前所有情景预设
import pkg.openai.dprompt as dprompt
reply_str = "[bot]当前所有情景预设({}模式):\n\n".format(config.preset_mode)
reply_str = "[bot]当前所有情景预设({}模式):\n\n".format(config['preset_mode'])
prompts = dprompt.mode_inst().list()