chatgpt-on-wechat
基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT-o1/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
Top Related Projects
ChatGPT for wechat https://github.com/AutumnWhj/ChatGPT-wechat-bot
Use ChatGPT On Wechat via wechaty
🤖一个基于 WeChaty 结合 OpenAi ChatGPT / Kimi / 讯飞等Ai服务实 现的微信机器人 ,可以用来帮助你自动回复微信消息,或者管理微信群/好友,检测僵尸粉等...
Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
Quick Overview
ChatGPT-on-WeChat is an open-source project that integrates ChatGPT into WeChat, allowing users to interact with the AI model through the popular messaging platform. It supports various AI models and plugins, making it a versatile tool for enhancing WeChat conversations with AI capabilities.
Pros
- Seamless integration of ChatGPT into WeChat, providing easy access to AI-powered conversations
- Support for multiple AI models, including ChatGPT, Claude, and others
- Extensible plugin system for customizing and expanding functionality
- Active development and community support
Cons
- Requires setup and hosting, which may be challenging for non-technical users
- Potential privacy concerns when using third-party AI services
- May be affected by changes in WeChat's API or policies
- Requires API keys or accounts for the supported AI services
Getting Started
-
Clone the repository:
git clone https://github.com/zhayujie/chatgpt-on-wechat.git cd chatgpt-on-wechat
-
Install dependencies:
pip install -r requirements.txt
-
Configure the project:
- Copy
config-template.json
toconfig.json
- Edit
config.json
to add your API keys and customize settings
- Copy
-
Run the application:
python3 app.py
-
Scan the QR code with your WeChat account to log in and start using the chatbot.
Competitor Comparisons
ChatGPT for wechat https://github.com/AutumnWhj/ChatGPT-wechat-bot
Pros of ChatGPT-wechat-bot
- Simpler setup process with fewer dependencies
- Supports both individual and group chat interactions
- Includes a web interface for easier management
Cons of ChatGPT-wechat-bot
- Less actively maintained (last update 3 months ago)
- Fewer features and customization options
- Limited documentation and community support
Code Comparison
ChatGPT-wechat-bot:
@itchat.msg_register(itchat.content.TEXT)
def reply_text(msg):
if not msg['FromUserName'] == myUserName:
print(msg['Text'])
reply = chatbot.get_chat_response(msg['Text'])
return reply
chatgpt-on-wechat:
@itchat.msg_register(itchat.content.TEXT)
def handler_single_msg(msg):
if not msg['FromUserName'] == myUserName:
context = Context(ContextType.SINGLE_CHAT, msg['FromUserName'])
reply = bot.reply_text(msg['Text'], context)
return reply
Both projects use the itchat
library for WeChat integration, but chatgpt-on-wechat implements a more sophisticated context handling system. This allows for better management of conversation history and user-specific settings.
While ChatGPT-wechat-bot offers a simpler implementation, chatgpt-on-wechat provides more features, better documentation, and active maintenance. The choice between the two depends on the user's needs for simplicity versus functionality.
Use ChatGPT On Wechat via wechaty
Pros of wechat-chatgpt
- Supports multiple OpenAI models, including GPT-3.5-turbo and text-davinci-003
- Offers a web interface for easier management and interaction
- Includes a built-in rate limiting feature to prevent excessive API usage
Cons of wechat-chatgpt
- Less actively maintained compared to chatgpt-on-wechat
- Fewer customization options for message handling and bot behavior
- Limited documentation and community support
Code Comparison
chatgpt-on-wechat:
async def handle_group_message(self, context):
if not self.config.get("group_chat_prefix"):
return
if context["msg"].startswith(self.config["group_chat_prefix"]):
await self.handle_message(context)
wechat-chatgpt:
async function onMessage(message) {
if (message.room() && !await message.mentionSelf()) {
return;
}
await handleMessage(message);
}
The code snippets show different approaches to handling group messages. chatgpt-on-wechat uses a prefix-based system, while wechat-chatgpt checks for mentions in group chats.
Both repositories provide integration between ChatGPT and WeChat, but chatgpt-on-wechat offers more features, better documentation, and active maintenance. wechat-chatgpt provides a simpler setup with multiple model support but lacks some advanced customization options.
🤖一个基于 WeChaty 结合 OpenAi ChatGPT / Kimi / 讯飞等Ai服务实现的微信机器人 ,可以用来帮助你自动回复微信消息, 或者管理微信群/好友,检测僵尸粉等...
Pros of wechat-bot
- Supports multiple AI models including ChatGPT, Claude, and Wenxin Yiyan
- Offers image generation capabilities using DALL-E
- Provides a web panel for easy management and configuration
Cons of wechat-bot
- Less actively maintained (last update 3 months ago vs. 12 days ago for chatgpt-on-wechat)
- Fewer stars and forks on GitHub, indicating potentially less community support
- Documentation is primarily in Chinese, which may be challenging for non-Chinese speakers
Code Comparison
chatgpt-on-wechat:
def handle_group(self, cmsg):
if cmsg.is_at:
content = cmsg.content.split(maxsplit=1)[-1].strip()
reply = self.chat_channel.handle_group(cmsg)
return reply
wechat-bot:
async function onMessage(msg) {
if (msg.room() && await msg.mentionSelf()) {
const content = await msg.mentionText()
const reply = await chatgpt.sendMessage(content)
await msg.say(reply)
}
}
Both repositories handle group messages and respond when the bot is mentioned. chatgpt-on-wechat uses Python, while wechat-bot uses JavaScript. The wechat-bot implementation appears more concise and uses async/await syntax for handling asynchronous operations.
Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
Pros of Wechaty
- Supports multiple chat platforms beyond WeChat (WhatsApp, Telegram, etc.)
- More extensive documentation and community support
- Offers a plugin system for easy extensibility
Cons of Wechaty
- More complex setup and configuration
- Requires more coding knowledge to implement custom features
- May have higher resource requirements due to its multi-platform support
Code Comparison
chatgpt-on-wechat:
@itchat.msg_register(itchat.content.TEXT)
def handle_text_msg(msg):
if msg['ToUserName'] == 'filehelper':
reply = chatgpt.get_chat_response(msg['Text'])
itchat.send(reply, 'filehelper')
Wechaty:
bot.on('message', async function(msg) {
if (msg.text() === 'ding') {
await msg.say('dong')
}
})
The chatgpt-on-wechat example shows a simple message handler using itchat, while the Wechaty example demonstrates a basic message listener. Wechaty's code is more flexible and can be easily adapted for different platforms.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ç®ä»
chatgpt-on-wechatï¼ç®ç§°CoWï¼é¡¹ç®æ¯åºäºå¤§æ¨¡åçæºè½å¯¹è¯æºå¨äººï¼æ¯æå¾®ä¿¡å ¬ä¼å·ãä¼ä¸å¾®ä¿¡åºç¨ãé£ä¹¦ãééæ¥å ¥ï¼å¯éæ©GPT3.5/GPT4.0/Claude/Gemini/LinkAI/ChatGLM/KIMI/æå¿ä¸è¨/讯é£æç«/éä¹åé®/LinkAIï¼è½å¤çææ¬ãè¯é³åå¾çï¼éè¿æ件访é®æä½ç³»ç»åäºèç½çå¤é¨èµæºï¼æ¯æåºäºèªæç¥è¯åºå®å¶ä¼ä¸AIåºç¨ã
ææ°çæ¬æ¯æçåè½å¦ä¸ï¼
- â å¤ç«¯é¨ç½²ï¼ æå¤ç§é¨ç½²æ¹å¼å¯éæ©ä¸åè½å®å¤ï¼ç®åå·²æ¯æå¾®ä¿¡å ¬ä¼å·ãä¼ä¸å¾®ä¿¡åºç¨ãé£ä¹¦ãééçé¨ç½²æ¹å¼
- â åºç¡å¯¹è¯ï¼ ç§èå群èçæ¶æ¯æºè½åå¤ï¼æ¯æå¤è½®ä¼è¯ä¸ä¸æè®°å¿ï¼æ¯æ GPT-3.5, GPT-4o-mini, GPT-4o, GPT-4, Claude-3.5, Gemini, æå¿ä¸è¨, 讯é£æç«, éä¹åé®ï¼ChatGLM-4ï¼Kimi(æä¹æé¢), MiniMax
- â è¯é³è½åï¼ å¯è¯å«è¯é³æ¶æ¯ï¼éè¿æåæè¯é³åå¤ï¼æ¯æ azure, baidu, google, openai(whisper/tts) çå¤ç§è¯é³æ¨¡å
- â å¾åè½åï¼ æ¯æå¾ççæãå¾çè¯å«ãå¾çå¾ï¼å¦ç §çä¿®å¤ï¼ï¼å¯éæ© Dall-E-3, stable diffusion, replicate, midjourney, CogView-3, vision模å
- â 丰å¯æä»¶ï¼ æ¯æ个æ§åæ件æ©å±ï¼å·²å®ç°å¤è§è²åæ¢ãæååé©ãææè¯è¿æ»¤ãè天记å½æ»ç»ãææ¡£æ»ç»å对è¯ãèç½æç´¢çæ件
- â ç¥è¯åºï¼ éè¿ä¸ä¼ ç¥è¯åºæ件èªå®ä¹ä¸å±æºå¨äººï¼å¯ä½ä¸ºæ°åå身ãæºè½å®¢æãç§åå©æ使ç¨ï¼åºäº LinkAI å®ç°
声æ
- æ¬é¡¹ç®éµå¾ª MITå¼æºåè®®ï¼ä» ç¨äºææ¯ç 究åå¦ä¹ ï¼ä½¿ç¨æ¬é¡¹ç®æ¶ééµå®æå¨å°æ³å¾æ³è§ãç¸å ³æ¿ç以åä¼ä¸ç« ç¨ï¼ç¦æ¢ç¨äºä»»ä½è¿æ³æä¾µç¯ä»äººæççè¡ä¸º
- å¢å 使ç¨è¯¥é¡¹ç®æ¶ï¼è¯·ä½¿ç¨å½å ååç大模åæå¡ï¼å¹¶è¿è¡å¿ è¦çå 容å®å ¨å®¡æ ¸åè¿æ»¤
- æ¬é¡¹ç®ä¸»è¦æ¥å ¥åååå ¬å¹³å°ï¼æ¨è使ç¨å ¬ä¼å·ãä¼å¾®èªå»ºåºç¨ãééãé£ä¹¦çæ¥å ¥ééï¼å ¶ä»éé为åå²äº§ç©å·²ä¸ç»´æ¤
- ä»»ä½ä¸ªäººãå¢éåä¼ä¸ï¼æ 论以ä½ç§æ¹å¼ä½¿ç¨è¯¥é¡¹ç®ã对ä½å¯¹è±¡æä¾æå¡ï¼æ产ççä¸ååæï¼æ¬é¡¹ç®åä¸æ¿æ ä»»ä½è´£ä»»
æ¼ç¤º
DEMOè§é¢ï¼https://cdn.link-ai.tech/doc/cow_demo.mp4
社åº
æ·»å å°å©æ微信å å ¥å¼æºé¡¹ç®äº¤æµç¾¤ï¼
ä¼ä¸æå¡
LinkAI æ¯é¢åä¼ä¸åå¼åè çä¸ç«å¼AIåºç¨å¹³å°ï¼èåå¤æ¨¡æ大模åãç¥è¯åºãAgent æ件ãå·¥ä½æµçè½åï¼æ¯æä¸é®æ¥å ¥ä¸»æµå¹³å°å¹¶è¿è¡ç®¡çï¼æ¯æSaaSãç§æåé¨ç½²å¤ç§æ¨¡å¼ã
LinkAI ç®å å·²å¨ç§åè¿è¥ãæºè½å®¢æãä¼ä¸æçå©æçåºæ¯ç§¯ç´¯äºä¸°å¯ç AI 解å³æ¹æ¡ï¼ å¨çµåãææãå¥åº·ãæ°æ¶è´¹ãç§æå¶é çåè¡ä¸æ²æ·äºå¤§æ¨¡åè½å°åºç¨çæä½³å®è·µï¼è´åäºå¸®å©æ´å¤ä¼ä¸åå¼åè æ¥æ± AI ç产åã
ä¼ä¸æå¡å产åå¨è¯¢ å¯è系产å顾é®ï¼
ð· æ´æ°æ¥å¿
2024.08.02ï¼ 1.7.0çæ¬ æ°å¢ 讯é£4.0 模åãç¥è¯åºå¼ç¨æ¥æºå±ç¤ºãç¸å ³æ件ä¼å
2024.07.19ï¼ 1.6.9çæ¬ æ°å¢ gpt-4o-mini 模åãé¿éè¯é³è¯å«ãä¼å¾®åºç¨æ¸ éè·¯ç±ä¼å
2024.07.05ï¼ 1.6.8çæ¬ å 1.6.7çæ¬ï¼Claude3.5, Gemini 1.5 Pro, MiniMax模åãå·¥ä½æµå¾çè¾å ¥ã模åå表å®å
2024.06.04ï¼ 1.6.6çæ¬ å 1.6.5çæ¬ï¼gpt-4o模åãééæµå¼å¡çã讯é£è¯é³è¯å«/åæ
2024.04.26ï¼ 1.6.0çæ¬ï¼æ°å¢ Kimi æ¥å ¥ãgpt-4-turboçæ¬å级ãæ件æ»ç»åè¯é³è¯å«é®é¢ä¿®å¤
2024.03.26ï¼ 1.5.8çæ¬ å 1.5.7çæ¬ï¼æ°å¢ GLM-4ãClaude-3 模åï¼edge-tts è¯é³æ¯æ
2024.01.26ï¼ 1.5.6çæ¬ å 1.5.5çæ¬ï¼ééæ¥å ¥ï¼toolæ件å级ï¼4-turbo模åæ´æ°
2023.11.11ï¼ 1.5.3çæ¬ å 1.5.4çæ¬ï¼æ°å¢éä¹åé®æ¨¡åãGoogle Gemini
2023.11.10ï¼ 1.5.2çæ¬ï¼æ°å¢é£ä¹¦ééãå¾åè¯å«å¯¹è¯ãé»ååé ç½®
2023.11.10ï¼ 1.5.0çæ¬ï¼æ°å¢
gpt-4-turbo
,dall-e-3
,tts
模åæ¥å ¥ï¼å®åå¾åç解&çæãè¯é³è¯å«&çæçå¤æ¨¡æè½å
2023.10.16ï¼ æ¯æéè¿æå¾è¯å«ä½¿ç¨LinkAIèç½æç´¢ãæ°å¦è®¡ç®ãç½é¡µè®¿é®çæ件ï¼åèæ件ææ¡£
2023.09.26ï¼ æ件å¢å æ件/æç« é¾æ¥ ä¸é®æ»ç»å对è¯çåè½ï¼ä½¿ç¨åèï¼æ件说æ
2023.08.08ï¼ æ¥å ¥ç¾åº¦æå¿ä¸è¨æ¨¡åï¼éè¿ æ件 æ¯æ Midjourney ç»å¾
2023.06.12ï¼ æ¥å ¥ LinkAI å¹³å°ï¼å¯å¨çº¿å建é¢åç¥è¯åºï¼æé ä¸å±å®¢ææºå¨äººã使ç¨åè æ¥å ¥ææ¡£ã
æ´æ©æ´æ°æ¥å¿æ¥ç: å½æ¡£æ¥å¿
ð å¿«éå¼å§
å¿«éå¼å§è¯¦ç»ææ¡£ï¼é¡¹ç®æ建ææ¡£
ä¸ãåå¤
1. è´¦å·æ³¨å
项ç®é»è®¤ä½¿ç¨OpenAIæ¥å£ï¼éåå¾ OpenAI注åé¡µé¢ å建账å·ï¼å建å®è´¦å·ååå¾ API管çé¡µé¢ å建ä¸ä¸ª API Key 并ä¿åä¸æ¥ï¼åé¢éè¦å¨é¡¹ç®ä¸é ç½®è¿ä¸ªkeyãæ¥å£éè¦æµ·å¤ç½ç»è®¿é®åç»å®ä¿¡ç¨å¡æ¯ä»ã
é»è®¤å¯¹è¯æ¨¡åæ¯ openai ç gpt-3.5-turboï¼è®¡è´¹æ¹å¼æ¯çº¦æ¯ 1000tokens (约750个è±æåè¯ æ 500æ±åï¼å å«è¯·æ±ååå¤) æ¶è $0.002ï¼å¾ççææ¯Dell E模åï¼æ¯å¼ æ¶è $0.016ã
项ç®åæ¶ä¹æ¯æä½¿ç¨ LinkAI æ¥å£ï¼æ é代çï¼å¯ä½¿ç¨ Kimiãæå¿ã讯é£ãGPT-3.5ãGPT-4o ç模åï¼æ¯æ å®å¶åç¥è¯åºãèç½æç´¢ãMJç»å¾ãææ¡£æ»ç»ãå·¥ä½æµçè½åãä¿®æ¹é ç½®å³å¯ä¸é®ä½¿ç¨ï¼åè æ¥å ¥ææ¡£ã
2.è¿è¡ç¯å¢
æ¯æ LinuxãMacOSãWindows ç³»ç»ï¼å¯å¨Linuxæå¡å¨ä¸é¿æè¿è¡)ï¼åæ¶éå®è£
Python
ã
建议Pythonçæ¬å¨ 3.7.1~3.9.X ä¹é´ï¼æ¨è3.8çæ¬ï¼3.10å以ä¸çæ¬å¨ MacOS å¯ç¨ï¼å ¶ä»ç³»ç»ä¸ä¸ç¡®å®è½å¦æ£å¸¸è¿è¡ã
注æï¼Docker æ Railway é¨ç½²æ éå®è£ pythonç¯å¢åä¸è½½æºç ï¼å¯ç´æ¥å¿«è¿å°ä¸ä¸èã
(1) å é项ç®ä»£ç ï¼
git clone https://github.com/zhayujie/chatgpt-on-wechat
cd chatgpt-on-wechat/
注: å¦éå°ç½ç»é®é¢å¯éæ©å½å éå https://gitee.com/zhayujie/chatgpt-on-wechat
(2) å®è£ æ ¸å¿ä¾èµ (å¿ é)ï¼
è½å¤ä½¿ç¨
itchat
å建æºå¨äººï¼å¹¶å ·ææå交æµåè½æéçæå°ä¾èµéåã
pip3 install -r requirements.txt
(3) æå±ä¾èµ (å¯éï¼å»ºè®®å®è£ )ï¼
pip3 install -r requirements-optional.txt
å¦ææ项ä¾èµå®è£ 失败å¯æ³¨éæ对åºçè¡å继ç»
äºãé ç½®
é
ç½®æ件ç模æ¿å¨æ ¹ç®å½çconfig-template.json
ä¸ï¼éå¤å¶è¯¥æ¨¡æ¿å建æç»çæç config.json
æ件ï¼
cp config-template.json config.json
ç¶åå¨config.json
ä¸å¡«å
¥é
ç½®ï¼ä»¥ä¸æ¯å¯¹é»è®¤é
ç½®ç说æï¼å¯æ ¹æ®éè¦è¿è¡èªå®ä¹ä¿®æ¹ï¼æ³¨æå®é
使ç¨æ¶è¯·å»æ注éï¼ä¿è¯JSONæ ¼å¼çå®æ´ï¼ï¼
# config.jsonæ件å
容示ä¾
{
"model": "gpt-3.5-turbo", # 模åå称, æ¯æ gpt-3.5-turbo, gpt-4, gpt-4-turbo, wenxin, xunfei, glm-4, claude-3-haiku, moonshot
"open_ai_api_key": "YOUR API KEY", # å¦æ使ç¨openAI模ååå¡«å
¥ä¸é¢å建ç OpenAI API KEY
"proxy": "", # 代ç客æ·ç«¯çipå端å£ï¼å½å
ç¯å¢å¼å¯ä»£ççéè¦å¡«å该项ï¼å¦ "127.0.0.1:7890"
"single_chat_prefix": ["bot", "@bot"], # ç§èæ¶ææ¬éè¦å
å«è¯¥åç¼æè½è§¦åæºå¨äººåå¤
"single_chat_reply_prefix": "[bot] ", # ç§èæ¶èªå¨åå¤çåç¼ï¼ç¨äºåºåç人
"group_chat_prefix": ["@bot"], # 群èæ¶å
å«è¯¥åç¼åä¼è§¦åæºå¨äººåå¤
"group_name_white_list": ["ChatGPTæµè¯ç¾¤", "ChatGPTæµè¯ç¾¤2"], # å¼å¯èªå¨åå¤ç群å称å表
"group_chat_in_one_session": ["ChatGPTæµè¯ç¾¤"], # æ¯æä¼è¯ä¸ä¸æå
±äº«ç群å称
"image_create_prefix": ["ç»", "ç", "æ¾"], # å¼å¯å¾çåå¤çåç¼
"conversation_max_tokens": 1000, # æ¯æä¸ä¸æè®°å¿çæå¤å符æ°
"speech_recognition": false, # æ¯å¦å¼å¯è¯é³è¯å«
"group_speech_recognition": false, # æ¯å¦å¼å¯ç¾¤ç»è¯é³è¯å«
"voice_reply_voice": false, # æ¯å¦ä½¿ç¨è¯é³åå¤è¯é³
"character_desc": "ä½ æ¯åºäºå¤§è¯è¨æ¨¡åçAIæºè½å©æï¼æ¨å¨åç并解å³äººä»¬çä»»ä½é®é¢ï¼å¹¶ä¸å¯ä»¥ä½¿ç¨å¤ç§è¯è¨ä¸äººäº¤æµã", # äººæ ¼æè¿°
# 订é
æ¶æ¯ï¼å
¬ä¼å·åä¼ä¸å¾®ä¿¡channelä¸è¯·å¡«åï¼å½è¢«è®¢é
æ¶ä¼èªå¨åå¤ï¼å¯ä½¿ç¨ç¹æ®å ä½ç¬¦ãç®åæ¯æçå ä½ç¬¦æ{trigger_prefix}ï¼å¨ç¨åºä¸å®ä¼èªå¨æ¿æ¢æbotç触åè¯ã
"subscribe_msg": "æè°¢æ¨çå
³æ³¨ï¼\nè¿éæ¯ChatGPTï¼å¯ä»¥èªç±å¯¹è¯ã\næ¯æè¯é³å¯¹è¯ã\næ¯æå¾çè¾åºï¼ç»åå¼å¤´çæ¶æ¯å°æè¦æ±åä½å¾çã\næ¯æè§è²æ®æ¼åæååé©ç丰å¯æ件ã\nè¾å
¥{trigger_prefix}#help æ¥ç详ç»æ令ã",
"use_linkai": false, # æ¯å¦ä½¿ç¨LinkAIæ¥å£ï¼é»è®¤å
³éï¼å¼å¯åå¯å½å
访é®ï¼ä½¿ç¨ç¥è¯åºåMJ
"linkai_api_key": "", # LinkAI Api Key
"linkai_app_code": "" # LinkAI åºç¨æå·¥ä½æµcode
}
é 置说æï¼
1.个人è天
- 个人è天ä¸ï¼éè¦ä»¥ "bot"æ"@bot" 为å¼å¤´çå
容触åæºå¨äººï¼å¯¹åºé
置项
single_chat_prefix
(å¦æä¸éè¦ä»¥åç¼è§¦åå¯ä»¥å¡«å"single_chat_prefix": [""]
) - æºå¨äººåå¤çå
容ä¼ä»¥ "[bot] " ä½ä¸ºåç¼ï¼ 以åºåç人ï¼å¯¹åºçé
置项为
single_chat_reply_prefix
(å¦æä¸éè¦åç¼å¯ä»¥å¡«å"single_chat_reply_prefix": ""
)
2.群ç»è天
- 群ç»è天ä¸ï¼ç¾¤å称éé
ç½®å¨
group_name_white_list
ä¸æè½å¼å¯ç¾¤èèªå¨åå¤ãå¦ææ³å¯¹ææ群èçæï¼å¯ä»¥ç´æ¥å¡«å"group_name_white_list": ["ALL_GROUP"]
- é»è®¤åªè¦è¢«äºº @ å°±ä¼è§¦åæºå¨äººèªå¨åå¤ï¼å¦å¤ç¾¤è天ä¸åªè¦æ£æµå°ä»¥ "@bot" å¼å¤´çå
容ï¼åæ ·ä¼èªå¨åå¤ï¼æ¹ä¾¿èªå·±è§¦åï¼ï¼è¿å¯¹åºé
置项
group_chat_prefix
- å¯éé
ç½®:
group_name_keyword_white_list
é 置项æ¯æ模ç³å¹é 群å称ï¼group_chat_keyword
é 置项åæ¯æ模ç³å¹é 群æ¶æ¯å 容ï¼ç¨æ³ä¸ä¸è¿°ä¸¤ä¸ªé 置项ç¸åãï¼Contributed by evolay) group_chat_in_one_session
ï¼ä½¿ç¾¤èå ±äº«ä¸ä¸ªä¼è¯ä¸ä¸æï¼é ç½®["ALL_GROUP"]
åä½ç¨äºææ群è
3.è¯é³è¯å«
- æ·»å
"speech_recognition": true
å°å¼å¯è¯é³è¯å«ï¼é»è®¤ä½¿ç¨openaiçwhisper模åè¯å«ä¸ºæåï¼åæ¶ä»¥æååå¤ï¼è¯¥åæ°ä» æ¯æç§è (注æç±äºè¯é³æ¶æ¯æ æ³å¹é åç¼ï¼ä¸æ¦å¼å¯å°å¯¹ææè¯é³èªå¨åå¤ï¼æ¯æè¯é³è§¦åç»å¾)ï¼ - æ·»å
"group_speech_recognition": true
å°å¼å¯ç¾¤ç»è¯é³è¯å«ï¼é»è®¤ä½¿ç¨openaiçwhisper模åè¯å«ä¸ºæåï¼åæ¶ä»¥æååå¤ï¼åæ°ä» æ¯æ群è (ä¼å¹é group_chat_prefixågroup_chat_keyword, æ¯æè¯é³è§¦åç»å¾)ï¼ - æ·»å
"voice_reply_voice": true
å°å¼å¯è¯é³åå¤è¯é³ï¼åæ¶ä½ç¨äºç§èå群èï¼
4.å ¶ä»é ç½®
model
: 模åå称ï¼ç®åæ¯ægpt-3.5-turbo
,gpt-4o-mini
,gpt-4o
,gpt-4
,wenxin
,claude
,gemini
,glm-4
,xunfei
,moonshot
çï¼å ¨é¨æ¨¡åå称åècommon/const.pyæ件temperature
,frequency_penalty
,presence_penalty
: Chat APIæ¥å£åæ°ï¼è¯¦æ åèOpenAIå®æ¹ææ¡£ãproxy
ï¼ç±äºç®åopenai
æ¥å£å½å æ æ³è®¿é®ï¼éé 置代ç客æ·ç«¯çå°åï¼è¯¦æ åè #351- 对äºå¾åçæï¼å¨æ»¡è¶³ä¸ªäººæ群ç»è§¦åæ¡ä»¶å¤ï¼è¿éè¦é¢å¤çå
³é®è¯åç¼æ¥è§¦åï¼å¯¹åºé
ç½®
image_create_prefix
- å
³äºOpenAI对è¯åå¾çæ¥å£çåæ°é
ç½®ï¼å
容èªç±åº¦ãåå¤åæ°éå¶ãå¾ç大å°çï¼ï¼å¯ä»¥åè 对è¯æ¥å£ å å¾åæ¥å£ ææ¡£ï¼å¨
config.py
ä¸æ£æ¥åªäºåæ°å¨æ¬é¡¹ç®ä¸æ¯å¯é ç½®çã conversation_max_tokens
ï¼è¡¨ç¤ºè½å¤è®°å¿çä¸ä¸ææ大åæ°ï¼ä¸é®ä¸ç为ä¸ç»å¯¹è¯ï¼å¦æ累积ç对è¯åæ°è¶ åºéå¶ï¼å°±ä¼ä¼å 移é¤ææ©çä¸ç»å¯¹è¯ï¼rate_limit_chatgpt
ï¼rate_limit_dalle
ï¼æ¯åéæé«é®çéçãç»å¾éçï¼è¶ éåæéæåºå¤çãclear_memory_commands
: 对è¯å æ令ï¼ä¸»å¨æ¸ 空åæè®°å¿ï¼å符串æ°ç»å¯èªå®ä¹æ令å«åãhot_reload
: ç¨åºéåºåï¼æåçäºç¶æï¼é»è®¤å ³éãcharacter_desc
é ç½®ä¸ä¿åçä½ å¯¹æºå¨äººè¯´çä¸æ®µè¯ï¼ä»ä¼è®°ä½è¿æ®µè¯å¹¶ä½ä¸ºä»ç设å®ï¼ä½ å¯ä»¥ä¸ºä»å®å¶ä»»ä½äººæ ¼ (å ³äºä¼è¯ä¸ä¸æçæ´å¤å 容åè该 issue)subscribe_msg
ï¼è®¢é æ¶æ¯ï¼å ¬ä¼å·åä¼ä¸å¾®ä¿¡channelä¸è¯·å¡«åï¼å½è¢«è®¢é æ¶ä¼èªå¨åå¤ï¼ å¯ä½¿ç¨ç¹æ®å ä½ç¬¦ãç®åæ¯æçå ä½ç¬¦æ{trigger_prefix}ï¼å¨ç¨åºä¸å®ä¼èªå¨æ¿æ¢æbotç触åè¯ã
5.LinkAIé ç½® (å¯é)
use_linkai
: æ¯å¦ä½¿ç¨LinkAIæ¥å£ï¼å¼å¯åå¯å½å 访é®ï¼ä½¿ç¨ç¥è¯åºåMidjourney
ç»ç», åè ææ¡£linkai_api_key
: LinkAI Api Keyï¼å¯å¨ æ§å¶å° å建linkai_app_code
: LinkAI åºç¨æå·¥ä½æµçcodeï¼éå¡«
æ¬è¯´æææ¡£å¯è½ä¼æªåæ¶æ´æ°ï¼å½åææå¯éçé
置项åå¨è¯¥config.py
ä¸ååºã
ä¸ãè¿è¡
1.æ¬å°è¿è¡
å¦ææ¯å¼åæº æ¬å°è¿è¡ï¼ç´æ¥å¨é¡¹ç®æ ¹ç®å½ä¸æ§è¡ï¼
python3 app.py # windowsç¯å¢ä¸è¯¥å½ä»¤é常为 python app.py
ç»ç«¯è¾åºäºç»´ç åï¼è¿è¡æ«ç ç»å½ï¼å½è¾åº "Start auto replying" æ¶è¡¨ç¤ºèªå¨åå¤ç¨åºå·²ç»æåè¿è¡äºï¼æ³¨æï¼ç¨äºç»å½çè´¦å·éè¦å¨æ¯ä»å¤å·²å®æå®å认è¯ï¼ãæ«ç ç»å½åä½ çè´¦å·å°±æ为æºå¨äººäºï¼å¯ä»¥å¨ææºç«¯éè¿é ç½®çå ³é®è¯è§¦åèªå¨åå¤ (ä»»æ好ååéæ¶æ¯ç»ä½ ï¼ææ¯èªå·±åæ¶æ¯ç»å¥½å)ï¼åè#142ã
2.æå¡å¨é¨ç½²
使ç¨nohupå½ä»¤å¨åå°è¿è¡ç¨åºï¼
nohup python3 app.py & tail -f nohup.out # å¨åå°è¿è¡ç¨åºå¹¶éè¿æ¥å¿è¾åºäºç»´ç
æ«ç ç»å½åç¨åºå³å¯è¿è¡äºæå¡å¨åå°ï¼æ¤æ¶å¯éè¿ ctrl+c
å
³éæ¥å¿ï¼ä¸ä¼å½±ååå°ç¨åºçè¿è¡ãä½¿ç¨ ps -ef | grep app.py | grep -v grep
å½ä»¤å¯æ¥çè¿è¡äºåå°çè¿ç¨ï¼å¦ææ³è¦éæ°å¯å¨ç¨åºå¯ä»¥å
kill
æ对åºçè¿ç¨ãæ¥å¿å
³éåå¦ææ³è¦å次æå¼åªéè¾å
¥Â tail -f nohup.out
ãæ¤å¤ï¼scripts
ç®å½ä¸æä¸é®è¿è¡ãå
³éç¨åºçèæ¬ä¾ä½¿ç¨ã
å¤è´¦å·æ¯æï¼ å°é¡¹ç®å¤å¶å¤ä»½ï¼åå«å¯å¨ç¨åºï¼ç¨ä¸åè´¦å·æ«ç ç»å½å³å¯å®ç°åæ¶è¿è¡ã
ç¹æ®æä»¤ï¼ ç¨æ·åæºå¨äººåé #reset å³å¯æ¸ 空该ç¨æ·çä¸ä¸æè®°å¿ã
3.Dockeré¨ç½²
使ç¨dockeré¨ç½²æ éä¸è½½æºç åå®è£ ä¾èµï¼åªéè¦è·å docker-compose.yml é ç½®æ件并å¯å¨å®¹å¨å³å¯ã
åææ¯éè¦å®è£ 好
docker
ådocker-compose
ï¼å®è£ æåç表ç°æ¯æ§è¡docker -v
ådocker-compose version
(æ docker compose version) å¯ä»¥æ¥çå°çæ¬å·ï¼å¯åå¾ dockerå®ç½ è¿è¡ä¸è½½ã
(1) ä¸è½½ docker-compose.yml æ件
wget https://open-1317903499.cos.ap-guangzhou.myqcloud.com/docker-compose.yml
ä¸è½½å®æåæå¼ docker-compose.yml
ä¿®æ¹æéé
ç½®ï¼å¦ OPEN_AI_API_KEY
å GROUP_NAME_WHITE_LIST
çã
(2) å¯å¨å®¹å¨
å¨ docker-compose.yml
æå¨ç®å½ä¸æ§è¡ä»¥ä¸å½ä»¤å¯å¨å®¹å¨ï¼
sudo docker compose up -d
è¿è¡ sudo docker ps
è½æ¥çå° NAMES 为 chatgpt-on-wechat ç容å¨å³è¡¨ç¤ºè¿è¡æåã
注æï¼
- å¦æ
docker-compose
æ¯ 1.X çæ¬ åéè¦æ§è¡sudo docker-compose up -d
æ¥å¯å¨å®¹å¨ - 该å½ä»¤ä¼èªå¨å» docker hub æå latest çæ¬çéåï¼latest éåä¼å¨æ¯æ¬¡é¡¹ç® release æ°ççæ¬æ¶çæ
æåè¿è¡ä»¥ä¸å½ä»¤å¯æ¥ç容å¨è¿è¡æ¥å¿ï¼æ«ææ¥å¿ä¸çäºç»´ç å³å¯å®æç»å½ï¼
sudo docker logs -f chatgpt-on-wechat
(3) æ件使ç¨
å¦æéè¦å¨docker容å¨ä¸ä¿®æ¹æ件é
ç½®ï¼å¯éè¿æè½½çæ¹å¼å®æï¼å° æ件é
ç½®æ件
éå½å为 config.json
ï¼æ¾ç½®äº docker-compose.yml
ç¸åç®å½ä¸ï¼å¹¶å¨ docker-compose.yml
ä¸ç chatgpt-on-wechat
é¨åä¸æ·»å volumes
æ å°:
volumes:
- ./config.json:/app/plugins/config.json
4. Railwayé¨ç½²
Railway æ¯ææä¾5ååæå¤500å°æ¶çå è´¹é¢åº¦ã (07.11æ´æ°: ç®å大é¨åè´¦å·å·²æ æ³å è´¹é¨ç½²)
- è¿å ¥ Railway
- ç¹å»
Deploy Now
æé®ã - 设置ç¯å¢åéæ¥éè½½ç¨åºè¿è¡çåæ°ï¼ä¾å¦
open_ai_api_key
,character_desc
ã
ä¸é®é¨ç½²:
ð 常è§é®é¢
FAQsï¼ https://github.com/zhayujie/chatgpt-on-wechat/wiki/FAQs
æç´æ¥å¨çº¿å¨è¯¢ 项ç®å°å©æ (è¯ææç»å®åä¸ï¼åå¤ä» ä¾åè)
ð ï¸ å¼å
欢è¿æ¥å ¥æ´å¤åºç¨ï¼åè Terminal代ç å®ç°æ¥æ¶ååéæ¶æ¯é»è¾å³å¯æ¥å ¥ã åæ¶æ¬¢è¿å¢å æ°çæ件ï¼åè æ件说æææ¡£ã
â èç³»
欢è¿æ交PRãIssuesï¼ä»¥åStaræ¯æä¸ä¸ãç¨åºè¿è¡éå°é®é¢å¯ä»¥æ¥ç 常è§é®é¢å表 ï¼å ¶æ¬¡åå¾ Issues ä¸æç´¢ã个人å¼åè å¯å å ¥å¼æºäº¤æµç¾¤åä¸æ´å¤è®¨è®ºï¼ä¼ä¸ç¨æ·å¯è系产å顾é®å¨è¯¢ã
ð è´¡ç®è
Top Related Projects
ChatGPT for wechat https://github.com/AutumnWhj/ChatGPT-wechat-bot
Use ChatGPT On Wechat via wechaty
🤖一个基于 WeChaty 结合 OpenAi ChatGPT / Kimi / 讯飞等Ai服务实现的微信机器人 ,可以用来帮助你自动回复微信消息,或者管理微信群/好友,检测僵尸粉等...
Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot