소스 검색

Merge branch 'master' into wechatmp

master
JS00000 1 년 전
부모
커밋
0adf8d6e5d
6개의 변경된 파일21개의 추가작업 그리고 11개의 파일을 삭제
  1. +1
    -1
      channel/chat_channel.py
  2. +2
    -1
      plugins/banwords/banwords.py
  3. +2
    -2
      plugins/bdunit/bdunit.py
  4. +6
    -1
      plugins/plugin_manager.py
  5. +5
    -3
      plugins/role/role.py
  6. +5
    -3
      plugins/sdwebui/sdwebui.py

+ 1
- 1
channel/chat_channel.py 파일 보기

@@ -48,7 +48,7 @@ class ChatChannel(Channel):
if first_in: # context首次传入时,receiver是None,根据类型设置receiver
config = conf()
cmsg = context['msg']
if cmsg.from_user_id == self.user_id and not config.get('trigger_by_self', False):
if cmsg.from_user_id == self.user_id and not config.get('trigger_by_self', True):
logger.debug("[WX]self message skipped")
return None
if context["isgroup"]:


+ 2
- 1
plugins/banwords/banwords.py 파일 보기

@@ -38,7 +38,8 @@ class Banwords(Plugin):
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
logger.info("[Banwords] inited")
except Exception as e:
logger.warn("Banwords init failed: %s, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/banwords ." % e)
logger.warn("[Banwords] init failed, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/banwords .")
raise e




+ 2
- 2
plugins/bdunit/bdunit.py 파일 보기

@@ -36,8 +36,8 @@ class BDunit(Plugin):
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
logger.info("[BDunit] inited")
except Exception as e:
logger.warn(
"BDunit init failed: %s, ignore " % e)
logger.warn("[BDunit] init failed, ignore ")
raise e

def on_handle_context(self, e_context: EventContext):



+ 6
- 1
plugins/plugin_manager.py 파일 보기

@@ -95,7 +95,12 @@ class PluginManager:
for name, plugincls in self.plugins.items():
if plugincls.enabled:
if name not in self.instances:
instance = plugincls()
try:
instance = plugincls()
except Exception as e:
logger.warn("Failed to create init %s, diabled. %s" % (name, e))
self.disable_plugin(name)
continue
self.instances[name] = instance
for event in instance.handlers:
if event not in self.listening_plugins:


+ 5
- 3
plugins/role/role.py 파일 보기

@@ -45,10 +45,12 @@ class Role(Plugin):
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
self.roleplays = {}
logger.info("[Role] inited")
except FileNotFoundError:
logger.warn(f"[Role] init failed, {config_path} not found, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/role .")
except Exception as e:
logger.warn("[Role] init failed, exception: %s, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/role ." % e)
if isinstance(e, FileNotFoundError):
logger.warn(f"[Role] init failed, {config_path} not found, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/role .")
else:
logger.warn("[Role] init failed, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/role .")
raise e

def get_role(self, name, find_closest=True):
name = name.lower()


+ 5
- 3
plugins/sdwebui/sdwebui.py 파일 보기

@@ -29,10 +29,12 @@ class SDWebUI(Plugin):
self.api = webuiapi.WebUIApi(**self.start_args)
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
logger.info("[SD] inited")
except FileNotFoundError:
logger.warn(f"[SD] init failed, {config_path} not found, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/sdwebui .")
except Exception as e:
logger.warn("[SD] init failed, exception: %s, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/sdwebui ." % e)
if isinstance(e, FileNotFoundError):
logger.warn(f"[SD] init failed, {config_path} not found, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/sdwebui .")
else:
logger.warn("[SD] init failed, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/sdwebui .")
raise e
def on_handle_context(self, e_context: EventContext):



Loading…
취소
저장