mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-21 22:27:13 +08:00
simple compatibility for wechaty
This commit is contained in:
@@ -129,7 +129,9 @@ class WechatyChannel(Channel):
|
|||||||
return
|
return
|
||||||
context = dict()
|
context = dict()
|
||||||
context['session_id'] = reply_user_id
|
context['session_id'] = reply_user_id
|
||||||
reply_text = super().build_reply_content(query, context)
|
context['type'] = 'TEXT'
|
||||||
|
context['content'] = query
|
||||||
|
reply_text = super().build_reply_content(query, context)['content']
|
||||||
if reply_text:
|
if reply_text:
|
||||||
await self.send(conf().get("single_chat_reply_prefix") + reply_text, reply_user_id)
|
await self.send(conf().get("single_chat_reply_prefix") + reply_text, reply_user_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -141,7 +143,8 @@ class WechatyChannel(Channel):
|
|||||||
return
|
return
|
||||||
context = dict()
|
context = dict()
|
||||||
context['type'] = 'IMAGE_CREATE'
|
context['type'] = 'IMAGE_CREATE'
|
||||||
img_url = super().build_reply_content(query, context)
|
context['content'] = query
|
||||||
|
img_url = super().build_reply_content(query, context)['content']
|
||||||
if not img_url:
|
if not img_url:
|
||||||
return
|
return
|
||||||
# 图片下载
|
# 图片下载
|
||||||
@@ -170,7 +173,9 @@ class WechatyChannel(Channel):
|
|||||||
context['session_id'] = str(group_id)
|
context['session_id'] = str(group_id)
|
||||||
else:
|
else:
|
||||||
context['session_id'] = str(group_id) + '-' + str(group_user_id)
|
context['session_id'] = str(group_id) + '-' + str(group_user_id)
|
||||||
reply_text = super().build_reply_content(query, context)
|
context['type'] = 'TEXT'
|
||||||
|
context['content'] = query
|
||||||
|
reply_text = super().build_reply_content(query, context)['content']
|
||||||
if reply_text:
|
if reply_text:
|
||||||
reply_text = '@' + group_user_name + ' ' + reply_text.strip()
|
reply_text = '@' + group_user_name + ' ' + reply_text.strip()
|
||||||
await self.send_group(conf().get("group_chat_reply_prefix", "") + reply_text, group_id)
|
await self.send_group(conf().get("group_chat_reply_prefix", "") + reply_text, group_id)
|
||||||
@@ -181,7 +186,8 @@ class WechatyChannel(Channel):
|
|||||||
return
|
return
|
||||||
context = dict()
|
context = dict()
|
||||||
context['type'] = 'IMAGE_CREATE'
|
context['type'] = 'IMAGE_CREATE'
|
||||||
img_url = super().build_reply_content(query, context)
|
context['content'] = query
|
||||||
|
img_url = super().build_reply_content(query, context)['content']
|
||||||
if not img_url:
|
if not img_url:
|
||||||
return
|
return
|
||||||
# 图片发送
|
# 图片发送
|
||||||
|
|||||||
Reference in New Issue
Block a user