From 5b85e60d5d5615fb5fb2bb82dfb7a2e17f59effe Mon Sep 17 00:00:00 2001 From: zwssunny Date: Mon, 27 Mar 2023 18:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BE=A4=E7=BB=84=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 6 +++--- bot/bot_factory.py | 6 +++--- config.py | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 7d42b9d..c78a72c 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ # encoding:utf-8 -import config +from config import conf, load_config from channel import channel_factory from common.log import logger @@ -9,10 +9,10 @@ from plugins import * def run(): try: # load config - config.load_config() + load_config() # create channel - channel_name='wx' + channel_name=conf().get('channel_type', 'wx') channel = channel_factory.create_channel(channel_name) if channel_name=='wx': PluginManager().load_plugins() diff --git a/bot/bot_factory.py b/bot/bot_factory.py index 06df336..cf9cfe7 100644 --- a/bot/bot_factory.py +++ b/bot/bot_factory.py @@ -6,9 +6,9 @@ from common import const def create_bot(bot_type): """ - create a channel instance - :param channel_type: channel type code - :return: channel instance + create a bot_type instance + :param bot_type: bot type code + :return: bot instance """ if bot_type == const.BAIDU: # Baidu Unit对话接口 diff --git a/config.py b/config.py index 5732969..9b3204f 100644 --- a/config.py +++ b/config.py @@ -70,6 +70,7 @@ available_setting = { # chatgpt指令自定义触发词 "clear_memory_commands": ['#清除记忆'], # 重置会话指令 + "channel_type": "wx", # 通道类型,支持wx,wxy和terminal }