Quellcode durchsuchen

Merge branch 'master' of github.com:zhayujie/chatgpt-on-wechat

master
zhayujie vor 7 Monaten
Ursprung
Commit
f45ff5fd0a
5 geänderte Dateien mit 18 neuen und 18 gelöschten Zeilen
  1. +0
    -1
      README.md
  2. +1
    -1
      bridge/reply.py
  3. +0
    -1
      channel/wechat/wechat_channel.py
  4. +16
    -14
      plugins/plugin_manager.py
  5. +1
    -1
      plugins/tool/tool.py

+ 0
- 1
README.md Datei anzeigen

@@ -23,7 +23,6 @@ Demo made by [Visionn](https://www.wangpc.cc/)
SaaS服务、私有化部署、稳定托管接入 等多种模式。
>
> 目前已在私域运营、智能客服、企业效率助手等场景积累了丰富的 AI 解决方案, 在电商、文教、健康、新消费等各行业沉淀了 AI 落地的最佳实践,致力于打造助力中小企业拥抱 AI 的一站式平台。

企业服务和商用咨询可联系产品顾问:

<img width="240" src="https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/product-manager-qrcode.jpg">


+ 1
- 1
bridge/reply.py Datei anzeigen

@@ -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 # 强制文本


+ 0
- 1
channel/wechat/wechat_channel.py Datei anzeigen

@@ -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 Datei anzeigen

@@ -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



+ 1
- 1
plugins/tool/tool.py Datei anzeigen

@@ -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), # 一个问题最多使用多少次工具


Laden…
Abbrechen
Speichern