瀏覽代碼

Merge branch 'zhayujie:master' into master

master
Haowei GitHub 8 月之前
父節點
當前提交
d0fd36e7e1
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: B5690EEEBB952194
共有 5 個文件被更改,包括 23 次插入19 次删除
  1. +1
    -0
      bot/linkai/link_ai_bot.py
  2. +1
    -1
      bridge/reply.py
  3. +5
    -3
      channel/chat_channel.py
  4. +0
    -1
      channel/wechat/wechat_channel.py
  5. +16
    -14
      plugins/plugin_manager.py

+ 1
- 0
bot/linkai/link_ai_bot.py 查看文件

@@ -92,6 +92,7 @@ class LinkAIBot(Bot):
"frequency_penalty": conf().get("frequency_penalty", 0.0), # [-2,2]之间,该值越大则更倾向于产生不同的内容
"presence_penalty": conf().get("presence_penalty", 0.0), # [-2,2]之间,该值越大则更倾向于产生不同的内容
"session_id": session_id,
"sender_id": session_id,
"channel_type": conf().get("channel_type", "wx")
}
try:


+ 1
- 1
bridge/reply.py 查看文件

@@ -11,7 +11,7 @@ class ReplyType(Enum):
VIDEO_URL = 5 # 视频URL
FILE = 6 # 文件
CARD = 7 # 微信名片,仅支持ntchat
InviteRoom = 8 # 邀请好友进群
INVITE_ROOM = 8 # 邀请好友进群
INFO = 9
ERROR = 10
TEXT_ = 11 # 强制文本


+ 5
- 3
channel/chat_channel.py 查看文件

@@ -170,11 +170,13 @@ class ChatChannel(Channel):
reply = self._generate_reply(context)

logger.debug("[WX] ready to decorate reply: {}".format(reply))

# reply的包装步骤
reply = self._decorate_reply(context, reply)
if reply and reply.content:
reply = self._decorate_reply(context, reply)

# reply的发送步骤
self._send_reply(context, reply)
# reply的发送步骤
self._send_reply(context, reply)

def _generate_reply(self, context: Context, reply: Reply = Reply()) -> Reply:
e_context = PluginManager().emit_event(


+ 0
- 1
channel/wechat/wechat_channel.py 查看文件

@@ -233,7 +233,6 @@ class WechatChannel(ChatChannel):
logger.info("[WX] sendImage url={}, receiver={}".format(img_url, receiver))
elif reply.type == ReplyType.IMAGE: # 从文件读取图片
image_storage = reply.content
image_storage.seek(0)
itchat.send_image(image_storage, toUserName=receiver)
logger.info("[WX] sendImage, receiver={}".format(receiver))
elif reply.type == ReplyType.FILE: # 新增文件回复类型


+ 16
- 14
plugins/plugin_manager.py 查看文件

@@ -99,7 +99,7 @@ class PluginManager:
try:
self.current_plugin_path = plugin_path
if plugin_path in self.loaded:
if self.loaded[plugin_path] == None:
if plugin_name.upper() != 'GODCMD':
logger.info("reload module %s" % plugin_name)
self.loaded[plugin_path] = importlib.reload(sys.modules[import_path])
dependent_module_names = [name for name in sys.modules.keys() if name.startswith(import_path + ".")]
@@ -141,19 +141,21 @@ class PluginManager:
failed_plugins = []
for name, plugincls in self.plugins.items():
if plugincls.enabled:
if name not in self.instances:
try:
instance = plugincls()
except Exception as e:
logger.warn("Failed to init %s, diabled. %s" % (name, e))
self.disable_plugin(name)
failed_plugins.append(name)
continue
self.instances[name] = instance
for event in instance.handlers:
if event not in self.listening_plugins:
self.listening_plugins[event] = []
self.listening_plugins[event].append(name)
if 'GODCMD' in self.instances and name == 'GODCMD':
continue
# if name not in self.instances:
try:
instance = plugincls()
except Exception as e:
logger.warn("Failed to init %s, diabled. %s" % (name, e))
self.disable_plugin(name)
failed_plugins.append(name)
continue
self.instances[name] = instance
for event in instance.handlers:
if event not in self.listening_plugins:
self.listening_plugins[event] = []
self.listening_plugins[event].append(name)
self.refresh_order()
return failed_plugins



Loading…
取消
儲存