zhayujie / chatgpt-on-wechat

基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT4.0/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
https://docs.link-ai.tech/cow
MIT License
28.35k stars 7.53k forks source link

对接公众号token成功后,如何自动回复 #1348

Open fattank opened 11 months ago

fattank commented 11 months ago

前置确认

⚠️ 搜索issues中是否已存在类似问题

操作系统类型?

Linux

运行的python版本是?

python 3.10

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wechatmp(公众号, 订阅号)

复现步骤 🕹

我对接个人公众号token已成功,IP白名单已加。 我没有域名直接使用的IP。 看了很久readme也没明白还需要哪些设置,才能让公众号收到私信时可以自动回复。就像微信聊天一样的回复。

问题描述 😯

我对接个人公众号token已成功,IP白名单已加。 我没有域名直接使用的IP。 看了很久readme也没明白还需要哪些设置,才能让公众号收到私信时可以自动回复。就像微信聊天一样的回复。

终端日志 📒

<此处粘贴终端日志>
zhayujie commented 11 months ago

把触发前缀设置为空,"single_chat_prefix": [""], 关注公众号后直接对话就好了,通知观察后台日志

fattank commented 11 months ago

我应该是这样设置的: 另外关注后,在手机上的公众号输入窗口,输入额应该是私信吧? "request_timeout": 90, "timeout": 120, "proxy": "",

"channel_type": "wechatmp", "wechatmp_token": "2", "wechatmp_port": 8080, "wechatmp_app_id": "wx", "wechatmp_app_secret": "9", "wechatmp_aes_key": "", "single_chat_prefix": [""], "single_chat_reply_prefix": "", "plugin_trigger_prefix": "&",

zhayujie @.***> 于2023年8月2日周三 17:18写道:

把触发前缀设置为空,"single_chat_prefix": [""], 关注公众号后直接对话就好了,通知观察后台日志

— Reply to this email directly, view it on GitHub https://github.com/zhayujie/chatgpt-on-wechat/issues/1348#issuecomment-1661845708, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMQQAKUDBVPIXSFZDZ3XTILP5ANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @.***>

--

Tank

fattank commented 11 months ago

把触发前缀设置为空,"single_chat_prefix": [""], 关注公众号后直接对话就好了,通知观察后台日志

感谢 作答。

zhayujie commented 11 months ago

我应该是这样设置的: 另外关注后,在手机上的公众号输入窗口,输入额应该是私信吧? "request_timeout": 90, "timeout": 120, "proxy": "", "channel_type": "wechatmp", "wechatmp_token": "2", "wechatmp_port": 8080, "wechatmp_app_id": "wx", "wechatmp_app_secret": "9", "wechatmp_aes_key": "", "single_chat_prefix": [""], "single_chat_reply_prefix": "", "plugin_trigger_prefix": "&", zhayujie @.> 于2023年8月2日周三 17:18写道: 把触发前缀设置为空,"single_chat_prefix": [""], 关注公众号后直接对话就好了,通知观察后台日志 — Reply to this email directly, view it on GitHub <#1348 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMQQAKUDBVPIXSFZDZ3XTILP5ANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @.> -- Tank

配置没问题,在公众号输入框输入后有回复嘛

fattank commented 11 months ago

我应该是这样设置的: 另外关注后,在手机上的公众号输入窗口,输入额应该是私信吧? "request_timeout": 90, "timeout": 120, "proxy": "", "channel_type": "wechatmp", "wechatmp_token": "2", "wechatmp_port": 8080, "wechatmp_app_id": "wx", "wechatmp_app_secret": "9", "wechatmp_aes_key": "", "single_chat_prefix": [""], "single_chat_reply_prefix": "", "plugin_triggerprefix": "&", zhayujie @.> 于2023年8月2日周三 17:18写道: 把触发前缀设置为空,"single_chatprefix": [""], 关注公众号后直接对话就好了,通知观察后台日志 — Reply to this email directly, view it on GitHub <#1348 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMQQAKUDBVPIXSFZDZ3XTILP5ANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @_._> -- Tank

配置没问题,在公众号输入框输入后有回复嘛

没有回复

zhayujie commented 11 months ago

我应该是这样设置的: 另外关注后,在手机上的公众号输入窗口,输入额应该是私信吧? "request_timeout": 90, "timeout": 120, "proxy": "", "channel_type": "wechatmp", "wechatmp_token": "2", "wechatmp_port": 8080, "wechatmp_app_id": "wx", "wechatmp_app_secret": "9", "wechatmp_aes_key": "", "single_chat_prefix": [""], "single_chat_reply_prefix": "", "plugin_triggerprefix": "&", zhayujie @.> 于2023年8月2日周三 17:18写道: 把触发前缀设置为空,"single_chatprefix": [""], 关注公众号后直接对话就好了,通知观察后台日志 — Reply to this email directly, view it on GitHub <#1348 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMQQAKUDBVPIXSFZDZ3XTILP5ANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @_._> -- Tank

配置没问题,在公众号输入框输入后有回复嘛

没有回复

后台日志有反应嘛,服务器是哪个地区的

fattank commented 11 months ago

我应该是这样设置的: 另外关注后,在手机上的公众号输入窗口,输入额应该是私信吧? "request_timeout": 90, "timeout": 120, "proxy": "", "channel_type": "wechatmp", "wechatmp_token": "2", "wechatmp_port": 8080, "wechatmp_app_id": "wx", "wechatmp_app_secret": "9", "wechatmp_aes_key": "", "single_chat_prefix": [""], "single_chat_reply_prefix": "", "plugin_triggerprefix": "&", zhayujie @.> 于2023年8月2日周三 17:18写道: 把触发前缀设置为空,"single_chatprefix": [""], 关注公众号后直接对话就好了,通知观察后台日志 — Reply to this email directly, view it on GitHub <#1348 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMQQAKUDBVPIXSFZDZ3XTILP5ANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @_._> -- Tank

配置没问题,在公众号输入框输入后有回复嘛

没有回复

后台日志有反应嘛,服务器是哪个地区的

服务器是美西区,ping过的,ping得通。

fattank commented 11 months ago

我应该是这样设置的: 另外关注后,在手机上的公众号输入窗口,输入额应该是私信吧? "request_timeout": 90, "timeout": 120, "proxy": "", "channel_type": "wechatmp", "wechatmp_token": "2", "wechatmp_port": 8080, "wechatmp_app_id": "wx", "wechatmp_app_secret": "9", "wechatmp_aes_key": "", "single_chat_prefix": [""], "single_chat_reply_prefix": "", "plugin_triggerprefix": "&", zhayujie @.> 于2023年8月2日周三 17:18写道: 把触发前缀设置为空,"single_chatprefix": [""], 关注公众号后直接对话就好了,通知观察后台日志 — Reply to this email directly, view it on GitHub <#1348 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMQQAKUDBVPIXSFZDZ3XTILP5ANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @_._> -- Tank

配置没问题,在公众号输入框输入后有回复嘛

没有回复

后台日志有反应嘛,服务器是哪个地区的

贴上一块日志: python3 app.py [INFO][2023-08-05 01:17:19][config.py:202] - [INIT] load config: {'open_ai_api_key': 'sk-baNs65Zes6Z', 'open_ai_api_base': 'https://api.openai.com/v1', 'model': 'gpt-3.5-turbo', 'temperature': 0.75, 'top_p': 0.5, 'frequency_penalty': 0.1, 'presence_penalty': 0.1, 'request_timeout': 90, 'timeout': 120, 'proxy': '', 'channel_type': 'wechatmp', 'wechatmp_token': '2cGOPB', 'wechatmp_port': 8080, 'wechatmp_app_id': 'wx00e3f', 'wechatmp_app_secret': '95cd965da', 'wechatmp_aes_key': '', 'single_chat_prefix': ['gpt'], 'single_chat_reply_prefix': 'gpt', 'plugin_trigger_prefix': '&', 'conversation_max_tokens': 4000, 'expires_in_seconds': 360, 'character_desc': '你是一位由OpenAI训练的GPT4型人工智能助手,能听懂各种人类语言,能读懂人类的情绪,并能用各种语言回答人们提出的 问题。', 'subscribe_msg': '感谢您的关注!\n这里是老谭的人工智能加强训练平台,可以自由对话。\n支持语音对话。\n支持图片输 入。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持tool、角色扮演和文字冒险等丰富的插件。\n输入{trigger_prefix}#help 查看详细指令。需要开发代码或更精确的回答要调整参数,可以联系我。', 'use_linkai': False, 'linkai_api_key': 'Link_OI0ToV2tIEYE4PpOeBpPZFPvNePxxx63JrQnX1JM', 'linkai_app_code': 'IUXkRfu8'} [INFO][2023-08-05 01:17:19][config.py:150] - [Config] User datas loaded. /home/tank/.local/lib/python3.10/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) [INFO][2023-08-05 01:17:19][plugin_manager.py:50] - Loading plugins config... [INFO][2023-08-05 01:17:19][plugin_manager.py:88] - Scaning plugins ... [INFO][2023-08-05 01:17:19][plugin_manager.py:41] - Plugin Role_v1.0 registered, path=./plugins/role [INFO][2023-08-05 01:17:19][plugin_manager.py:41] - Plugin Dungeon_v1.0 registered, path=./plugins/dungeon chatgpt-tool-hub version: 0.4.6 [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin tool_v0.4 registered, path=./plugins/tool [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin Finish_v1.0 registered, path=./plugins/finish [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin Keyword_v0.1 registered, path=./plugins/keyword [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin Hello_v0.1 registered, path=./plugins/hello [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin Godcmd_v1.0 registered, path=./plugins/godcmd [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins/banwords [INFO][2023-08-05 01:17:20][plugin_manager.py:41] - Plugin BDunit_v0.1 registered, path=./plugins/bdunit [INFO][2023-08-05 01:17:20][plugin_manager.py:80] - load all config from plugins/config.json: {'godcmd': {'password': '710', 'admin_users': []}, 'banwords': {'action': 'replace', 'reply_filter': True, 'reply_action': 'ignore'}, 'tool': {'tools': ['python', 'url-get', 'terminal', 'meteo-weather', 'wolfram-alpha', 'bing-search', 'news'], 'kwargs': {'top_k_results': 2, 'no_default': False, 'openai_api_key': 'sk-baNZes6Z', 'model_name': 'gpt-3.5-turbo-16k', 'wolfram_alpha_appid': 'H2ER7', 'bing_subscription_key': '1a8e942660', 'morning_news_api_key': 'JtVEyitFOxkofhv6', 'morning_news_use_llm': 'false'}}} [INFO][2023-08-05 01:17:20][godcmd.py:205] - [Godcmd] inited [INFO][2023-08-05 01:17:20][keyword.py:40] - [keyword] {} [INFO][2023-08-05 01:17:20][keyword.py:42] - [keyword] inited. [INFO][2023-08-05 01:17:20][init.py:29] - [visual_dl] init failed, error_info: ModuleNotFoundError("No module named 'torch'") [INFO][2023-08-05 01:17:20][init.py:29] - [visual_dl] init failed, error_info: ModuleNotFoundError("No module named 'torch'") [INFO][2023-08-05 01:17:20][chatgpt.py:186] - proxy no find, directly request to chatgpt instead [INFO][2023-08-05 01:17:20][chatgpt.py:186] - proxy no find, directly request to chatgpt instead [INFO][2023-08-05 01:17:20][chatgpt.py:186] - proxy no find, directly request to chatgpt instead [INFO][2023-08-05 01:17:20][chatgpt.py:186] - proxy no find, directly request to chatgpt instead [INFO][2023-08-05 01:17:20][victorinox.py:86] - use_tools=['news', 'python', 'url-get', 'terminal', 'wolfram-alpha', 'meteo-weather', 'bing-search'], params: {'debug': False, 'openai_api_key': 'sk-baNYM5Zes6Z', 'open_ai_api_base': 'https://api.openai.com/v1', 'deployment_id': '', 'proxy': '', 'request_timeout': 90, 'model_name': 'gpt-3.5-turbo-16k', 'no_default': False, 'top_k_results': 2, 'news_api_key': '', 'bing_subscription_key': '4af2660', 'google_api_key': '', 'google_cse_id': '', 'searx_search_host': '', 'wolfram_alpha_appid': 'E7964ER7', 'morning_news_api_key': 'JtVv6', 'cuda_device': 'cpu', 'think_depth': 3, 'arxiv_summary': True, 'morning_news_use_llm': 'false', 'llm_api_key': 'sk-baNYM6Z', 'llm_api_base_url': 'https://api.openai.com/v1'} [INFO][2023-08-05 01:17:20][tool.py:31] - [tool] inited [INFO][2023-08-05 01:17:20][banwords.py:52] - [Banwords] inited [INFO][2023-08-05 01:17:20][role.py:69] - [Role] inited [INFO][2023-08-05 01:17:20][dungeon.py:56] - [Dungeon] inited [INFO][2023-08-05 01:17:20][finish.py:23] - [Finish] inited http://0.0.0.0:8080/

zhayujie commented 11 months ago

我看配置中 'single_chat_prefix': ['gpt']

要带gpt 的前缀才能触发吧

fattank commented 11 months ago

我是两种都在尝试,都没成功,另外看后台,连连接服务器的尝试都没有。

zhayujie @.***>于2023年8月6日 周日11:16写道:

我看配置中 'single_chat_prefix': ['gpt']

要带gpt 的前缀才能触发吧

— Reply to this email directly, view it on GitHub https://github.com/zhayujie/chatgpt-on-wechat/issues/1348#issuecomment-1666693506, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRNJMTGQU5PSZ3EZMXWUR3XT4EABANCNFSM6AAAAAA3A4HFCI . You are receiving this because you authored the thread.Message ID: @.***>

--

Tank

fattank commented 11 months ago

我看配置中 'single_chat_prefix': ['gpt']

要带gpt 的前缀才能触发吧

微信mp后台设置的自动回复也关闭了的。

liulang100 commented 9 months ago

大佬 这个问题解决了嘛 我和您的情况一摸一样:卡在了 http://0.0.0.0:80/这句话上不过我用的是文心一言 [INFO][2023-10-09 11:23:56][config.py:223] - [INIT] load config: {'use_baidu_wenxin': 'True', 'baidu_wenxin_model': 'eb-instant', 'baidu_wenxin_api_key': 'BdykNlLfWBbdXrSBVH85z', 'baidu_wenxin_secret_key': 'qB3dv3ncnbw5eq4fWM9QbZryvb', 'channel_type': 'wechatmp', 'wechatmp_port': 80, 'wechatmp_app_id': '05eb68746b', 'wechatmp_app_secret': '5537ad16eafbccd50c94e595c6', 'wechatmp_token': 'token', 'wechatmp_aes_key': 'IiowiU3Zi1VQludJke8gywyTjg94oUlEx1FIK', 'hot_reload': False, 'single_chat_prefix': ['gpt'], 'single_chat_reply_prefix': '', 'group_chat_prefix': ['@bot'], 'group_name_white_list': ['None', 'None2'], 'group_chat_in_one_session': ['None'], 'image_create_prefix': ['画', '看', '找'], 'speech_recognition': False, 'group_speech_recognition': False, 'voice_reply_voice': False, 'conversation_max_tokens': 1000, 'expires_in_seconds': 3600, 'character_desc': '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。', 'subscribe_msg': '感谢您的关注!\n这里是ChatGPT,可以自由对话。\n支持语音对话。\n支持图片输入。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持tool、角色扮演和文字冒险等丰富的插件。\n输入{trigger_prefix}#help 查看详细指令。', 'use_linkai': False, 'linkai_api_key': '', 'linkai_app_code': ''} [INFO][2023-10-09 11:23:56][config.py:171] - [Config] User datas loaded. [WARNING][2023-10-09 11:23:57][audio_convert.py:9] - import pysilk failed, wechaty voice message will not be supported. [INFO][2023-10-09 11:23:57][plugin_manager.py:50] - Loading plugins config... [INFO][2023-10-09 11:23:57][plugin_manager.py:88] - Scaning plugins ... [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins\banwords [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin BDunit_v0.1 registered, path=./plugins\bdunit [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Dungeon_v1.0 registered, path=./plugins\dungeon [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Finish_v1.0 registered, path=./plugins\finish [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Godcmd_v1.0 registered, path=./plugins\godcmd [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Hello_v0.1 registered, path=./plugins\hello [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Keyword_v0.1 registered, path=./plugins\keyword [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin linkai_v0.1.0 registered, path=./plugins\linkai [INFO][2023-10-09 11:23:57][plugin_manager.py:41] - Plugin Role_v1.0 registered, path=./plugins\role [WARNING][2023-10-09 11:23:57][plugin_manager.py:113] - Failed to import plugin tool: No module named 'chatgpt_tool_hub' [INFO][2023-10-09 11:23:57][godcmd.py:194] - [Godcmd] 因未设置口令,本次的临时口令为1867。 [INFO][2023-10-09 11:23:57][godcmd.py:210] - [Godcmd] inited [INFO][2023-10-09 11:23:57][keyword.py:40] - [keyword] {} [INFO][2023-10-09 11:23:57][keyword.py:42] - [keyword] inited. [INFO][2023-10-09 11:23:57][linkai.py:34] - [LinkAI] inited, config={'group_app_map': {'测试群名1': 'default', '测试群名2': 'Kv2fXJcH'}, 'midjourney': {'enabled': False, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': False, 'group_enabled': True, 'max_file_size': 5000}, 'knowledge_base': {'search_miss_text_enabled': False, 'search_miss_similarity': 0.8, 'search_miss_suffix': '\n-------------\n回复仅供参考,请以官方文档为准'}} [INFO][2023-10-09 11:23:57][role.py:69] - [Role] inited [INFO][2023-10-09 11:23:57][dungeon.py:56] - [Dungeon] inited [INFO][2023-10-09 11:23:57][hello.py:23] - [Hello] inited [INFO][2023-10-09 11:23:57][finish.py:23] - [Finish] inited [INFO][2023-10-09 11:23:57][wechatmp_channel.py:62] - channel.wechatmp---------------------- http://0.0.0.0:80/

LuhangRui commented 7 months ago

@liulang100 @fattank 我好像找到原因了,根据发送任意文字。日志显示没有任何请求进来,证明微信没有转发。所以问题的原因是,已经修改了配置,但是没有启用。 2a9030702de7c9543039ff13143d09a

xiongwujun commented 7 months ago

我也是没启用导致的

MasterKe2003 commented 5 months ago

人才

fimreal commented 1 month ago

同样问题,配置完公众号对话没有返回,服务器上没有访问日志,ip白名单加过了,微信后台是已启用状态。还有哪里会影响的

LuhangRui commented 1 month ago

同样问题,配置完公众号对话没有返回,服务器上没有访问日志,ip白名单加过了,微信后台是已启用状态。还有哪里会影响的

没有访问日志的话要检查服务器地址配置有没有/wx

fimreal commented 1 month ago

同样问题,配置完公众号对话没有返回,服务器上没有访问日志,ip白名单加过了,微信后台是已启用状态。还有哪里会影响的

没有访问日志的话要检查服务器地址配置有没有/wx

感谢回复,找到问题,用 gemini key 填的不对。没有报错,可能是请求不了llm ,request 卡住了