🚀 基于 WeChatPadPro 协议的智能微信机器人,支持多AI模型、插件化架构!
本项目基于 chatgpt-on-wechat 框架,适配 WeChatPadPro 协议实现。
# 1. 克隆项目
git clone https://github.com/5201213/wechatpadpro-on-wechat.git
cd wechatpadpro-on-wechat
# 2. 安装依赖
pip install -r requirements.txt
pip install -r requirements-optional.txt # 可选功能
# 3. 配置文件
cp config-template.json config.json
# 编辑 config.json 填入配置
# 4. 启动服务
python app.py
{
"channel_type": "wxpad",
"model": "dify",
// WeChatPadPro 服务配置
"wechatpadpro_base_url": "",
"wechatpadpro_admin_key": "",
"wechatpadpro_user_key": "",
"wechatpadpro_ws_url": "",
// AI模型配置(根据选择的model配置对应API)
"dify_api_base": "",
"dify_api_key": "",
// 触发配置
"single_chat_prefix": [""],
"group_chat_prefix": ["@bot", "bot"],
"group_name_white_list": ["ALL_GROUP"],
// 功能开关
"image_recognition": true,
"speech_recognition": true,
"voice_reply_voice": true,
"sharing_to_text_enabled": false
}
| 配置项 | 说明 | 必填 |
|---|---|---|
channel_type |
通道类型,固定为 wxpad |
✅ |
model |
AI模型名称,如 dify、gpt-4、gemini-2.0-flash 等 |
✅ |
wechatpadpro_base_url |
WeChatPadPro服务地址 | ✅ |
wechatpadpro_admin_key |
管理员密钥 | ✅ |
wechatpadpro_user_key |
用户密钥(可选,扫码后自动获取) | ❌ |
group_name_white_list |
群聊白名单,["ALL_GROUP"] 表示所有群 |
✅ |
本项目需要配合 WeChatPadPro 服务使用。
config.json 中{
"wechatpadpro_base_url": "http://localhost:1239",
"wechatpadpro_admin_key": "你的管理员密钥",
"wechatpadpro_ws_url": "ws://localhost:1239/ws/GetSyncMsg"
}
| 插件名称 | 功能描述 | 使用场景 |
|---|---|---|
| ChatSummary | 聊天记录总结 | 群聊内容回顾、会议记录整理 |
| JinaSum | 网页内容总结 | 自动抓取并总结网页内容 |
| GodCmd | 管理员命令 | 系统管理、状态监控、重启等 |
| Hello | 示例插件 | 插件开发参考 |
import plugins
from plugins import *
@plugins.register(name="MyPlugin", desc="我的插件", version="1.0", author="作者")
class MyPlugin(Plugin):
def __init__(self):
super().__init__()
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
def on_handle_context(self, e_context: EventContext):
content = e_context['context']['content']
if content.startswith('$hello'):
reply = Reply(ReplyType.TEXT, '你好!')
e_context['reply'] = reply
e_context.action = EventAction.BREAK_PASS
wechatpadpro-on-wechat/
├── app.py # 主程序入口
├── config-template.json # 配置模板
├──
├── bot/ # AI模型适配层
├── channel/ # 通信通道层
│ └── wxpad/ # WeChatPadPro通道
├── plugins/ # 插件系统
├── lib/ # 第三方库封装
│ └── wxpad/ # WeChatPadPro客户端
├── bridge/ # 消息桥接层
├── common/ # 公共工具
└── voice/ # 语音处理
{
"sharing_to_text_enabled": true, // 分享消息处理开关
"tmp_cleanup_enabled": true, // 临时文件清理
"tmp_cleanup_interval": 3600, // 清理间隔(秒)
"voice_to_text": "dify", // 语音转文字服务
"text_to_voice": "dify", // 文字转语音服务
"image_recognition": true // 图片识别开关
}
{
"group_name_white_list": ["技术交流群", "ALL_GROUP"],
"group_name_keyword_white_list": ["技术", "开发"],
"group_chat_in_one_session": ["技术交流群"],
"group_chat_prefix": ["@bot", "bot"],
"group_chat_keyword": ["帮助", "help"]
}
Q: 机器人无法登录微信? - 检查WeChatPadPro服务是否正常运行 - 确认配置文件中的连接参数正确 - 查看防火墙是否阻止了相关端口
Q: 消息发送失败? - 检查微信账号是否被限制 - 确认目标用户/群聊是否存在 - 查看API调用是否超出限制
Q: AI回复不准确? - 检查AI模型配置和API密钥 - 调整系统提示词(character_desc) - 确认网络连接正常
# 查看运行日志
tail -f logs/wechat_robot.log
# 查看错误日志
grep "ERROR" logs/wechat_robot.log
欢迎贡献代码、文档、插件等!
# 1. Fork 项目
git clone https://github.com/your-username/wechatpadpro-on-wechat.git
# 2. 创建开发分支
git checkout -b feature/your-feature
# 3. 安装依赖
pip install -r requirements.txt
# 4. 提交代码
git commit -m "feat: add your feature"
git push origin feature/your-feature
本项目采用 MIT License 开源协议。
🌟 如果这个项目对你有帮助,请给个Star支持一下!
Made with ❤️ by the Community
$ claude mcp add wechatpadpro-on-wechat \
-- python -m otcore.mcp_server <graph>