mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-21 06:07:13 +08:00
Merge pull request #382 from Bachery/master
support group chat in one seesion
This commit is contained in:
@@ -155,7 +155,7 @@ class WechatChannel(Channel):
|
||||
if not query:
|
||||
return
|
||||
context = dict()
|
||||
context['from_user_id'] = reply_user_id
|
||||
context['session_id'] = reply_user_id
|
||||
reply_text = super().build_reply_content(query, context)
|
||||
if reply_text:
|
||||
self.send(conf().get("single_chat_reply_prefix") + reply_text, reply_user_id)
|
||||
@@ -189,11 +189,19 @@ class WechatChannel(Channel):
|
||||
if not query:
|
||||
return
|
||||
context = dict()
|
||||
context['from_user_id'] = msg['ActualUserName']
|
||||
group_name = msg['User']['NickName']
|
||||
group_id = msg['User']['UserName']
|
||||
group_chat_in_one_session = conf().get('group_chat_in_one_session', [])
|
||||
if ('ALL_GROUP' in group_chat_in_one_session or \
|
||||
group_name in group_chat_in_one_session or \
|
||||
self.check_contain(group_name, group_chat_in_one_session)):
|
||||
context['session_id'] = group_id
|
||||
else:
|
||||
context['session_id'] = msg['ActualUserName']
|
||||
reply_text = super().build_reply_content(query, context)
|
||||
if reply_text:
|
||||
reply_text = '@' + msg['ActualNickName'] + ' ' + reply_text.strip()
|
||||
self.send(conf().get("group_chat_reply_prefix", "") + reply_text, msg['User']['UserName'])
|
||||
self.send(conf().get("group_chat_reply_prefix", "") + reply_text, group_id)
|
||||
|
||||
|
||||
def check_prefix(self, content, prefix_list):
|
||||
|
||||
Reference in New Issue
Block a user