diff --git a/README.md b/README.md index 46541d0..dadf801 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Demo made by [Visionn](https://www.wangpc.cc/) SaaS服务、私有化部署、稳定托管接入 等多种模式。 > > 目前已在私域运营、智能客服、企业效率助手等场景积累了丰富的 AI 解决方案, 在电商、文教、健康、新消费等各行业沉淀了 AI 落地的最佳实践,致力于打造助力中小企业拥抱 AI 的一站式平台。 - 企业服务和商用咨询可联系产品顾问: diff --git a/bridge/reply.py b/bridge/reply.py index 0031484..f2293bd 100644 --- a/bridge/reply.py +++ b/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 # 强制文本 diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index 717b068..a65269c 100644 --- a/channel/wechat/wechat_channel.py +++ b/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: # 新增文件回复类型 diff --git a/plugins/plugin_manager.py b/plugins/plugin_manager.py index 49c13ca..cecf75d 100644 --- a/plugins/plugin_manager.py +++ b/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 diff --git a/plugins/tool/tool.py b/plugins/tool/tool.py index c80a945..a2ce4b6 100644 --- a/plugins/tool/tool.py +++ b/plugins/tool/tool.py @@ -137,7 +137,7 @@ class Tool(Plugin): return { # 全局配置相关 - "log": True, # tool 日志开关 + "log": False, # tool 日志开关 "debug": kwargs.get("debug", False), # 输出更多日志 "no_default": kwargs.get("no_default", False), # 不要默认的工具,只加载自己导入的工具 "think_depth": kwargs.get("think_depth", 2), # 一个问题最多使用多少次工具