Browse Source

fix: adjust log level

master
zhayujie 1 year ago
parent
commit
71b4cf57c3
4 changed files with 6 additions and 6 deletions
  1. +1
    -1
      README.md
  2. +2
    -2
      channel/wechat/wechat_channel.py
  3. +1
    -1
      common/log.py
  4. +2
    -2
      config-template.json

+ 1
- 1
README.md View File

@@ -8,7 +8,7 @@
- [x] **文本对话:** 接收私聊及群组中的微信消息,使用ChatGPT生成回复内容,完成自动回复 - [x] **文本对话:** 接收私聊及群组中的微信消息,使用ChatGPT生成回复内容,完成自动回复
- [x] **规则定制化:** 支持私聊中按指定规则触发自动回复,支持对群组设置自动回复白名单 - [x] **规则定制化:** 支持私聊中按指定规则触发自动回复,支持对群组设置自动回复白名单
- [x] **多账号:** 支持多微信账号同时运行 - [x] **多账号:** 支持多微信账号同时运行
- [x] **图片生成:** 支持根据描述生成图片,并自动发送至个人聊天或群聊
- [x] **图片生成:** 支持根据描述生成图片,并自动发送至个人聊天或群聊




# 更新日志 # 更新日志


+ 2
- 2
channel/wechat/wechat_channel.py View File

@@ -40,7 +40,7 @@ class WechatChannel(Channel):
itchat.run() itchat.run()


def handle(self, msg): def handle(self, msg):
logger.info("[WX]receive msg: " + json.dumps(msg, ensure_ascii=False))
logger.debug("[WX]receive msg: " + json.dumps(msg, ensure_ascii=False))
from_user_id = msg['FromUserName'] from_user_id = msg['FromUserName']
to_user_id = msg['ToUserName'] # 接收人id to_user_id = msg['ToUserName'] # 接收人id
other_user_id = msg['User']['UserName'] # 对手方id other_user_id = msg['User']['UserName'] # 对手方id
@@ -73,7 +73,7 @@ class WechatChannel(Channel):




def handle_group(self, msg): def handle_group(self, msg):
logger.info("[WX]receive group msg: " + json.dumps(msg, ensure_ascii=False))
logger.debug("[WX]receive group msg: " + json.dumps(msg, ensure_ascii=False))
group_name = msg['User'].get('NickName', None) group_name = msg['User'].get('NickName', None)
group_id = msg['User'].get('UserName', None) group_id = msg['User'].get('UserName', None)
if not group_name: if not group_name:


+ 1
- 1
common/log.py View File

@@ -4,7 +4,7 @@ import sys


def _get_logger(): def _get_logger():
log = logging.getLogger('log') log = logging.getLogger('log')
log.setLevel(logging.DEBUG)
log.setLevel(logging.INFO)
console_handle = logging.StreamHandler(sys.stdout) console_handle = logging.StreamHandler(sys.stdout)
console_handle.setFormatter(logging.Formatter('[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d] - %(message)s', console_handle.setFormatter(logging.Formatter('[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d] - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')) datefmt='%Y-%m-%d %H:%M:%S'))


+ 2
- 2
config-template.json View File

@@ -1,8 +1,8 @@
{ {
"open_ai_api_key": "YOUR API KEY", "open_ai_api_key": "YOUR API KEY",
"single_chat_prefix": ["bt", "@bt"],
"single_chat_prefix": ["bot", "@bot"],
"single_chat_reply_prefix": "[bot] ", "single_chat_reply_prefix": "[bot] ",
"group_chat_prefix": ["@bt"],
"group_chat_prefix": ["@bot"],
"group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"], "group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"],
"image_create_prefix": ["画", "看", "找"] "image_create_prefix": ["画", "看", "找"]
} }

Loading…
Cancel
Save