{"id":13642794,"url":"https://github.com/lich0821/wechatrobot","last_synced_at":"2025-05-14T06:13:34.913Z","repository":{"id":62030015,"uuid":"541147441","full_name":"lich0821/WeChatRobot","owner":"lich0821","description":"微信机器人，接入Gemini、ChatGPT、ChatGLM、讯飞星火、Tigerbot；成语接龙、天气预报、新闻摘要、定时任务。","archived":false,"fork":false,"pushed_at":"2025-04-03T01:59:29.000Z","size":13542,"stargazers_count":1844,"open_issues_count":6,"forks_count":395,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-05T10:01:35.663Z","etag":null,"topics":["chatglm","chatgpt","gemini","python","wechat","xunfei"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lich0821.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-25T11:25:24.000Z","updated_at":"2025-04-04T15:40:00.000Z","dependencies_parsed_at":"2023-10-02T12:19:46.757Z","dependency_job_id":"85a65972-d23e-49c2-a52e-6cb53920c4a3","html_url":"https://github.com/lich0821/WeChatRobot","commit_stats":{"total_commits":155,"total_committers":12,"mean_commits":"12.916666666666666","dds":0.2645161290322581,"last_synced_commit":"675953551cc98e73177a3e3ee53feed06f1e4a78"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lich0821%2FWeChatRobot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lich0821%2FWeChatRobot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lich0821%2FWeChatRobot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lich0821%2FWeChatRobot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lich0821","download_url":"https://codeload.github.com/lich0821/WeChatRobot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248567535,"owners_count":21125850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatglm","chatgpt","gemini","python","wechat","xunfei"],"created_at":"2024-08-02T01:01:36.323Z","updated_at":"2025-04-12T12:36:55.762Z","avatar_url":"https://github.com/lich0821.png","language":"Python","readme":"# WeChatRobot\n一个基于 [WeChatFerry](https://github.com/lich0821/WeChatFerry) 的微信机器人示例。\n\n|[📖 文档](https://wechatferry.readthedocs.io/)|[📺 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/GDDULcaMGjiS_TnOI6pvLw)|[🚨【微信机器人】沙雕行为合集](https://mp.weixin.qq.com/s/mc8O5iuhy46X4Bgqs80E8g)|\n|:-:|:-:|:-:|:-:|\n\n|![碲矿](https://s2.loli.net/2023/09/25/fub5VAPSa8srwyM.jpg)|![赞赏](https://s2.loli.net/2023/09/25/gkh9uWZVOxzNPAX.jpg)|\n|:-:|:-:|\n|后台回复 `WCF` 加群交流|如果你觉得有用|\n\n## Quick Start\n0. 遇到问题先看看上面的**文档、教程和 FAQ。**\n    - 按照步骤来，版本保持一致，少走弯路。\n    - 按照步骤来，版本保持一致，少走弯路。\n    - 按照步骤来，版本保持一致，少走弯路。\n1. 安装 Python\u003e=3.9（Python 12 需要自己编译依赖，慎选），例如 [3.10.11](https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe)\n2. 安装微信对应版本，下载地址在 [这里](https://github.com/lich0821/WeChatFerry/releases/latest) 找到。\n3. 克隆项目\n```sh\ngit clone https://github.com/lich0821/WeChatRobot.git\n\n# 如果网络原因打不开，可以科学上网，或者使用gitee\ngit clone https://gitee.com/lch0821/WeChatRobot.git\n```\n\n如果觉得克隆复杂，也可以直接下载 [最新版](https://github.com/lich0821/WeChatRobot/releases/latest) 到本地解压。\n\n4. 安装依赖\n```sh\n# 升级 pip\npython -m pip install -U pip\n# 安装必要依赖\npip install -r requirements.txt\n# 国内用户可能会因为网络问题出现安装失败，届时可使用镜像源来下载\npip install -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirements.txt\n# ChatGLM 还需要安装一个 kernel\nipython kernel install --name chatglm3 --user\n```\n\n5. 运行\n\n我们需要运行两次 `main.py` 第一次是生成配置文件 `config.yaml`, 第二次是真正跑你的机器人。\n直接运行程序会自动拉起微信，如果微信未打开，会自动打开微信；如果版本不对，也会有提示；其他报错，请进群交流。\n\n下面代码为第一次运行：第一次运行 `main.py` 会在 WeChatRobot 目录下生成一个 `config.yaml` 文件，参照修改配置进行修改。\n\n其中 chatgpt、tigerbot、chatglm 和 xinghuo_web 是四种模型的配置信息，你需要配置它们的参数，不知道的可以加群交流。\n\n```sh\npython main.py\n\n# 需要停止按 Ctrl+C\n```\n\n启动之后，可以正常接收消息但不会响应群消息。参考下方 [修改配置](#config) 进行配置，以便响应特定群聊。\n\n下面代码为第二次运行：你可以通过命令行参数选择模型，默认是不选择，这样你配置了什么参数就跑什么模型。正因如此你需要配置前面所说四种模型中的至少一种（当然也可以都配置，想跑那个模型就选什么参数）, 然后就可以开始使用你的机器人了。\n```sh\npython main.py\n\n# 需要停止按 Ctrl+C\n```\n\n如果你配置了多个模型（不需要将其他配置注释或者移除），下面的内容才对你有帮助否则略过，通过 `python main.py -h` 通过参数可以选择要跑的模型。\n```sh\n# 查看帮助\npython main.py -h\n#optional arguments:\n#  -h, --help            show this help message and exit\n#  -c C, --chat_model C  选择要使用的AI模型，默认不选择，可选参数：1. tigerbot 模型 2. chatgpt 模型 3. 讯飞星火模型 4. chatglm 模型\n```\n\n```sh\n# 例: 我想运行选择chatgpt的机器人\npython main.py -c 2\n\n# 需要停止按 Ctrl+C\n```\n\n\u003e python main.py -c C 其中参数 C 可选择如下所示\n\u003e\u003e 1. tigerbot 模型\n\u003e\u003e 2. chatgpt 模型\n\u003e\u003e 3. 讯飞星火模型\n\u003e\u003e 4. chatglm 模型\n\n6. 停止\n\n不要那么粗暴，温柔点儿；\n\n不要直接关闭窗口，温柔点儿。\n\n输入：`Ctrl+C`。否则，会出现各种奇怪问题。\n\n### \u003ca name=\"config\"\u003e\u003c/a\u003e修改配置\nℹ️ *修改配置后，需要重新启动，以便让配置生效。*\n\n配置文件 `config.yaml` 是运行程序后自动从模板复制过来的，功能默认关闭。\n\n#### 响应被 @ 消息\n为了响应群聊消息，需要添加相应的 `roomId`。\n\n第一次运行的时候，可以在手机上往需要响应的群里发消息，打印的消息中方括号里的就是；多个群用 `,` 分隔。\n```yaml\ngroups:\n  enable: [] # 允许响应的群 roomId，大概长这样：2xxxxxxxxx3@chatroom, 多个群用 `,` 分隔\n```\n\n#### 配置 AI 模型\n为了使用 AI 模型，需要对相应模型并进行配置。\n\n使用 ChatGLM 见注意事项 [README.MD](base/chatglm/README.MD)\n\n```yaml\nchatgpt:  # -----chatgpt配置这行不填-----\n  key:  # 填写你 ChatGPT 的 key\n  api: https://api.openai.com/v1  # 如果你不知道这是干嘛的，就不要改\n  proxy:  # 如果你在国内，你可能需要魔法，大概长这样：http://域名或者IP地址:端口号\n  prompt: 你是智能聊天机器人，你叫 wcferry  # 根据需要对角色进行设定\n\nchatglm:  # -----chatglm配置这行不填-----\n  key: sk-012345678901234567890123456789012345678901234567 # 这个应该不用动\n  api: http://localhost:8000/v1  # 根据自己的chatglm地址修改\n  proxy:  # 如果你在国内，你可能需要魔法，大概长这样：http://域名或者IP地址:端口号\n  prompt: 你是智能聊天机器人，你叫小薇  # 根据需要对角色进行设定\n  file_path: C:/Pictures/temp  #设定生成图片和代码使用的文件夹路径\n\ntigerbot:  # -----tigerbot配置这行不填-----\n  key:  # key\n  model:  # tigerbot-7b-sft\n\n# 抓取方式详见文档：https://www.bilibili.com/read/cv27066577\nxinghuo_web:  # -----讯飞星火web模式api配置这行不填-----\n  cookie:  # cookie\n  fd:  # fd\n  GtToken:  # GtToken\n  prompt: 你是智能聊天机器人，你叫 wcferry。请用这个角色回答我的问题  # 根据需要对角色进行设定\n\nbard: # -----bard配置这行不填-----\n  api_key: # api-key 创建地址：https://ai.google.dev/pricing，创建后复制过来即可\n  model_name: gemini-pro # 新模型上线后可以选择模型\n  proxy: http://127.0.0.1:7890  # 如果你在国内，你可能需要魔法，大概长这样：http://域名或者IP地址:端口号\n  # 提示词尽可能用英文，bard对中文提示词的效果不是很理想，下方提示词为英语老师的示例，请按实际需要修改,默认设置的提示词为谷歌创造的AI大语言模型\n  # I want you to act as a spoken English teacher and improver. I will speak to you in English and you will reply to me in English to practice my spoken English. I want you to keep your reply neat, limiting the reply to 100 words. I want you to strictly correct my grammar mistakes, typos, and factual errors. I want you to ask me a question in your reply. Now let's start practicing, you could ask me a question first. Remember, I want you to strictly correct my grammar mistakes, typos, and factual errors.\n  prompt: You am a large language model, trained by Google.\n\ndeepseek: sk-xxxxxxxxxxxxxxx # -----deepseek配置这行不填-----\n  #思维链相关功能默认关闭，开启后会增加响应时间和消耗更多的token\n  key:  # 填写你的 DeepSeek API Key\n  api: https://api.deepseek.com  # DeepSeek API 地址\n  model: deepseek-chat  # 可选: deepseek-chat (DeepSeek-V3), deepseek-reasoner (DeepSeek-R1)\n  prompt: 你是智能聊天机器人，你叫 DeepSeek 助手  # 根据需要对角色进行设定\n  enable_reasoning: false  # 是否启用思维链功能，仅在使用 deepseek-reasoner 模型时有效\n  show_reasoning: false  # 是否在回复中显示思维过程，仅在启用思维链功能时有效\n```\n\n## 至开发者\n```\n在接入图片生成的相关功能时，可将调用文件放入image文件夹内。\n在 image/__init__.py 文件内加入对应的模块儿，以便作为Python包来调用。\n在 configuration.py 内也要加入相关的代码，否则会初始化失败。\n文生图相关功能，全部默认开启，如果均未配置，全部转接至语言大模型。\n```\n[文生图功能的使用说明](./image/文生图功能的使用说明.MD)\n\n## HTTP\n如需要使用 HTTP 接口，请参考：\n* [wcfrust](https://github.com/lich0821/wcf-client-rust)（基于 Rust），开箱即用：[快速开始](https://github.com/lich0821/wcf-client-rust?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)。\n\n* GoHttp（基于 Go），参考 [GoHttp README.MD](https://github.com/lich0821/WeChatFerry/blob/master/clients/gohttp/README.md)\n\n## 更多客户端\n见 [WeChatFerry](https://github.com/lich0821/WeChatFerry?tab=readme-ov-file#python)。\n","funding_links":[],"categories":["Chatbots"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flich0821%2Fwechatrobot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flich0821%2Fwechatrobot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flich0821%2Fwechatrobot/lists"}