[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-kx-Huang--ChatGPT-on-WeChat":3,"tool-kx-Huang--ChatGPT-on-WeChat":64},[4,17,27,35,48,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",144730,2,"2026-04-07T23:26:32",[13,14,15],"开发框架","Agent","语言模型","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,3,"2026-04-06T11:19:32",[15,26,14,13],"图像",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":10,"last_commit_at":33,"category_tags":34,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":10,"last_commit_at":41,"category_tags":42,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",85013,"2026-04-06T11:09:19",[26,43,44,45,14,46,15,13,47],"数据工具","视频","插件","其他","音频",{"id":49,"name":50,"github_repo":51,"description_zh":52,"stars":53,"difficulty_score":23,"last_commit_at":54,"category_tags":55,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[14,26,13,15,46],{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":23,"last_commit_at":62,"category_tags":63,"status":16},519,"PaddleOCR","PaddlePaddle\u002FPaddleOCR","PaddleOCR 是一款基于百度飞桨框架开发的高性能开源光学字符识别工具包。它的核心能力是将图片、PDF 等文档中的文字提取出来，转换成计算机可读取的结构化数据，让机器真正“看懂”图文内容。\n\n面对海量纸质或电子文档，PaddleOCR 解决了人工录入效率低、数字化成本高的问题。尤其在人工智能领域，它扮演着连接图像与大型语言模型（LLM）的桥梁角色，能将视觉信息直接转化为文本输入，助力智能问答、文档分析等应用场景落地。\n\nPaddleOCR 适合开发者、算法研究人员以及有文档自动化需求的普通用户。其技术优势十分明显：不仅支持全球 100 多种语言的识别，还能在 Windows、Linux、macOS 等多个系统上运行，并灵活适配 CPU、GPU、NPU 等各类硬件。作为一个轻量级且社区活跃的开源项目，PaddleOCR 既能满足快速集成的需求，也能支撑前沿的视觉语言研究，是处理文字识别任务的理想选择。",75097,"2026-04-07T22:51:14",[15,26,13,46],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":81,"owner_email":82,"owner_twitter":82,"owner_website":83,"owner_url":84,"languages":85,"stars":94,"forks":95,"last_commit_at":96,"license":97,"difficulty_score":23,"env_os":98,"env_gpu":99,"env_ram":98,"env_deps":100,"category_tags":107,"github_topics":108,"view_count":10,"oss_zip_url":82,"oss_zip_packed_at":82,"status":16,"created_at":113,"updated_at":114,"faqs":115,"releases":154},5475,"kx-Huang\u002FChatGPT-on-WeChat","ChatGPT-on-WeChat","🤖️ Deploy GPT-4o ChatGPT on your WeChat within 2 steps! 两步在云端部署你的微信ChatGPT聊天机器人！🤖️","ChatGPT-on-WeChat 是一款开源项目，旨在让用户仅需两步即可在云端将微信变身成为强大的 AI 聊天机器人。它通过集成 Wechaty SDK 与 OpenAI API，打通了微信生态与大语言模型（如 GPT-4o、GPT-3.5-turbo）之间的连接，让用户能在熟悉的微信界面中直接体验顶尖 AI 的对话能力。\n\n这一工具主要解决了普通用户难以直接在微信中使用先进 AI 服务的痛点，同时也为开发者提供了一套稳定、快速且可持久运行的部署方案。无论是个人用户希望提升日常沟通效率，还是技术爱好者想要探索 AI 在即时通讯场景中的应用，ChatGPT-on-WeChat 都提供了灵活的支持。\n\n该项目特别适合具备一定技术基础的开发者或研究人员使用，他们可以通过本地或云平台（如 Railway、阿里云 ComputeNest）轻松部署，并根据需求自定义触发关键词、选择不同模型或扩展任务处理逻辑。其核心亮点在于极简的部署流程、对多种 AI 模型的兼容支持，以及基于成熟框架构建的稳定运行机制。\n\n如果你希望在微信中拥有一个智能助手，或者想尝试将大模型能力融入社交场景，ChatGPT-o","ChatGPT-on-WeChat 是一款开源项目，旨在让用户仅需两步即可在云端将微信变身成为强大的 AI 聊天机器人。它通过集成 Wechaty SDK 与 OpenAI API，打通了微信生态与大语言模型（如 GPT-4o、GPT-3.5-turbo）之间的连接，让用户能在熟悉的微信界面中直接体验顶尖 AI 的对话能力。\n\n这一工具主要解决了普通用户难以直接在微信中使用先进 AI 服务的痛点，同时也为开发者提供了一套稳定、快速且可持久运行的部署方案。无论是个人用户希望提升日常沟通效率，还是技术爱好者想要探索 AI 在即时通讯场景中的应用，ChatGPT-on-WeChat 都提供了灵活的支持。\n\n该项目特别适合具备一定技术基础的开发者或研究人员使用，他们可以通过本地或云平台（如 Railway、阿里云 ComputeNest）轻松部署，并根据需求自定义触发关键词、选择不同模型或扩展任务处理逻辑。其核心亮点在于极简的部署流程、对多种 AI 模型的兼容支持，以及基于成熟框架构建的稳定运行机制。\n\n如果你希望在微信中拥有一个智能助手，或者想尝试将大模型能力融入社交场景，ChatGPT-on-WeChat 是一个值得关注的实用工具。","# ChatGPT on WeChat ![GitHub License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fkx-huang\u002Fchatgpt-on-wechat?label=License&color=orange) [![wakatime](https:\u002F\u002Fwakatime.com\u002Fbadge\u002Fgithub\u002Fkx-Huang\u002FChatGPT-on-WeChat.svg)](https:\u002F\u002Fwakatime.com\u002Fbadge\u002Fgithub\u002Fkx-Huang\u002FChatGPT-on-WeChat) ![Railway Deploy](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fchecks-status\u002Fkx-huang\u002Fchatgpt-on-wechat\u002Fmaster?logo=railway&style=flat&label=Deploy) ![GitHub Repo stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fkx-huang\u002Fchatgpt-on-wechat?style=social)\n\n\u003C!-- omit in toc -->\n\n🤖️ Turn your WeChat into ChatGPT [**within only 2 steps!**](#12-deploy-on-cloud) 🤖️\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_95cddda4806e.png\" alt=\"Group chat demo for @kx-Huang\u002FChatGPT-on-WeChat\" \u002F>\n\u003C\u002Fp>\n\n## Features \u003C!-- omit in toc -->\n\nThis project is implemented based on [this amazing project](https:\u002F\u002Fgithub.com\u002Ffuergaosi233\u002Fwechat-chatgpt) that I contibuted before, with [`Wechaty SDK`](https:\u002F\u002Fgithub.com\u002Fwechaty\u002Fwechaty) and `OpenAI API`, we achieve:\n\n- fast and robust connection to a set of AI models with different features, typically `gpt-4o` and `gpt-3.5-turbo` which powers `ChatGPT`\n- stable, persistent and rapid deployment on cloud servers `Railway`\n\n## 0. Table of Content \u003C!-- omit in toc -->\n\n- [ChatGPT on WeChat    ](#chatgpt-on-wechat----)\n  - [1. How to Deploy this Bot?](#1-how-to-deploy-this-bot)\n    - [1.1 Deploy in Local](#11-deploy-in-local)\n      - [1.1.1 Get your OpenAI API Keys](#111-get-your-openai-api-keys)\n      - [1.1.2 Configure Environment Variables](#112-configure-environment-variables)\n      - [1.1.3 Setup the Docker](#113-setup-the-docker)\n      - [1.1.4 Login your WeChat](#114-login-your-wechat)\n    - [1.2 Deploy on Railway](#12-deploy-on-railway)\n      - [1.2.1 Configure on `Railway`](#121-configure-on-railway)\n      - [1.2.2 Deploy \\& Login on `Railway`](#122-deploy--login-on-railway)\n    - [1.3 Deploy on Alibaba Cloud ComputeNest](#13-deploy-on-alibaba-cloud-computenest)\n  - [2. Any Fancy Advanced Settings?](#2-any-fancy-advanced-settings)\n    - [2.1 Config Reply in Error](#21-config-reply-in-error)\n    - [2.2 Config `OpenAI` Models](#22-config-openai-models)\n    - [2.3 Config Model Features](#23-config-model-features)\n    - [2.4 Add Customized Task Handler](#24-add-customized-task-handler)\n  - [3. Common Errors and Troubleshooting](#3-common-errors-and-troubleshooting)\n    - [3.1 Assertion Error during Login or Self-chat 🤯](#31-assertion-error-during-login-or-self-chat-)\n    - [3.2 I can't trigger auto reply 🤔](#32-i-cant-trigger-auto-reply-)\n  - [4. How to Contribute to this Project?](#4-how-to-contribute-to-this-project)\n  - [5. Acknowledgement](#5-acknowledgement)\n  - [Thanks for your support by starring this project!](#thanks-for-your-support-by-starring-this-project)\n\n## 1. How to Deploy this Bot?\n\nYou can deploy **in local** or **on cloud**,  whatever you want.\n\nThe [deploy on cloud](#12-deploy-on-cloud) method is recommended.\n\n### 1.1 Deploy in Local\n\n#### 1.1.1 Get your OpenAI API Keys\n\n- `openaiApiKey` can be generated in the [**API Keys Page** in your OpenAI account](https:\u002F\u002Fbeta.openai.com\u002Faccount\u002Fapi-keys)\n- `openaiOrganizationID` is optional, which can be found in the [**Settings Page** in your Open AI account](https:\u002F\u002Fbeta.openai.com\u002Faccount\u002Forg-settings)\n\n---\n\n#### 1.1.2 Configure Environment Variables\n\nYou can copy the template `config.yaml.example` into a new file `config.yaml`, and paste the configurations:\n\n```yaml\nopenaiApiKey: \"\u003Cyour_openai_api_key>\"\nopenaiOrganizationID: \"\u003Cyour_organization_id>\"\nchatgptTriggerKeyword: \"\u003Cyour_keyword>\"\n```\n\nOr you can export the environment variables listed in `.env.example` to your system, which is a more encouraged method to keep your `OpenAI API Key` safe:\n\n```bash\nexport OPENAI_API_KEY=\"sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport OPENAI_ORGANIZATION_KEY=\"org-XXXXXXXXXXXXXXX\"\nexport CHATGPT_TRIGGER_KEYWORD=\"Hi bot:\"\n```\n\n**Please note:**\n\n- `chatgptTriggerKeyword` is the keyword which can trigger auto-reply:\n  - In private chat, the message **starts with** it will trigger auto-reply\n  - In group chat, the message **starts with** `@Name \u003Ckeyword>` will trigger auto-reply\n- `chatgptTriggerKeyword` can be **empty string**, which means:\n  - In private chat, **every messages** will trigger auto-reply\n  - In group chat, only **\"@ the bot\"** will trigger auto-reply\n\n---\n\n#### 1.1.3 Setup the Docker\n\n1. Setup Docker Image\n\n```bash\ndocker build -t chatgpt-on-wechat .\n```\n\n2. Setup Docker Container\n\n```bash\ndocker run -v $(pwd)\u002Fconfig.yaml:\u002Fapp\u002Fconfig.yaml chatgpt-on-wechat\n```\n\nYou can also build with Docker Compose:\n\n1. Start the container\n\n```bash\ndocker-compose up -d\n```\n\n2. View the QR code to log in to wechat\n\n```bash\ndocker-compose logs -f\n```\n\n---\n\n#### 1.1.4 Login your WeChat\n\nOnce you deploy the bot successfully, just follow the `terminal` or `Logs` in Docker container prompt carefully:\n\n1. Scan the QR Code with mobile WeChat\n2. Click \"Log in\" to allow desktop login (where our bot stays)\n3. Wait a few seconds and start chatting!\n\n🤖 **Enjoy your powerful chatbot!** 🤖\n\n---\n\n### 1.2 Deploy on Railway\n\nClick the button below to fork this repo and deploy with Railway!\n\n[![Deploy on Railway](https:\u002F\u002Frailway.app\u002Fbutton.svg)](https:\u002F\u002Frailway.app\u002Fnew\u002Ftemplate\u002FzKIfYk?referralCode=D6wD0x)\n\n---\n\n#### 1.2.1 Configure on `Railway`\n\nFill in the following blanks:\n\n1. Your forked repo name (can be any name you like)\n2. Choose make it private or not (also up to you)\n3. Environment variables (for how to get OpenAI API keys, please refer to [1.1.1 Get your OpenAI API Keys](#111-get-your-openai-api-keys))\n\n![Railway Config](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_1526a5df6cb8.png)\n\n**Please note:**\n\nMake sure the environment variables are set in RailWay instead of writing directly in `config.yaml`. It's really **NOT** recommended to implicitly write out your `OpenAI API Key` in public repo. Anyone with your key can get access to the OpenAI API services, and it's possbile for you to lose money if you pay for that.\n\n---\n\n#### 1.2.2 Deploy & Login on `Railway`\n\nThe deploy process is automatic. It may take a few minutes for the first time. As you see the `Success`, click the tab to see the details. (which is your secret WeChat console!)\n\n![Railway Deploy](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_4af48bcab48a.png)\n\nClick `Deply Logs` and you will see everything is setting up, wait for a QR Code to pop up. Scan it as if you are login to your desktop WeChat, and click \"Log in\" on your mobile WeChat.\n\n![Railway Scan QR Code](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_a3278014ebb9.png)\n\nFinally, everything is good to go! You will see the logs when people sending you messagem, and whenever the chatbot is auto-triggered to reply.\n\n### 1.3 Deploy on Alibaba Cloud ComputeNest\n\nOne-click deployment on Alibaba Cloud ComputeNest: \n\n[![Deploy on AlibabaCloud ComputeNest](doc\u002Fimg\u002Fdeploy_to_computenest.svg)](https:\u002F\u002Fcomputenest.console.aliyun.com\u002Fservice\u002Finstance\u002Fcreate\u002Fdefault?type=user&ServiceName=ChatGPT-on-WeChat社区版)\n\nFollow the deployment guide to deploy ChatGPT-on-WeChat on Alibaba Cloud. Both domestic site and internationl sites are supported.\n- [Deployment Guide (domestic site)](https:\u002F\u002Fcomputenest.console.aliyun.com\u002Fservice\u002Fdetail\u002Fcn-hangzhou\u002Fservice-a81e49ab7dd24520a365?isInstance=true)\n- [Deployment Guide (internationl site)](https:\u002F\u002Fcomputenest.console.aliyun.com\u002Fservice\u002Fdetail\u002Fap-southeast-1\u002Fservice-37a1f9f9b9e1482ba61b?isInstance=true)\nSwitch Alibaba Cloud console's language to see guide in different language.\n\nFirst, provides cloud resource configurations such as ECS instance type and network configurations. \n![ECS instance configuration](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_80154388f926.png)\nAlso needs to set ChatGPT-On-WeChat software configuration.\n![ChatGPT-On-WeChat software configuration](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_faa7e4239bdd.png)\n\nWhen you confirm to deploy, Alibaba Cloud ComputeNest creates ECS instance in your owner Alibaba Cloud account, deploys ChatGPT-on-WeChat application and starts it on ECS instance automatically. \n\nAfter ComputeNest service instance is deployed, check \"How to use\" about how to login to ECS instance.\n\n![How to use](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_ed6c72533e7d.png)\n\nRun command in ECS workbench to get the QR code.\n![QR code](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_db7d74cedb88.png)\n\nScan it as if you are login to your desktop WeChat, and click \"Log in\" on your mobile WeChat.\n\nFinally, everything is good to go! You will see the logs when people sending you messagem, and whenever the chatbot is auto-triggered to reply.\n\n\n## 2. Any Fancy Advanced Settings?\n\n### 2.1 Config Reply in Error\n\nWhen the OpenAI API encounters some errors (e.g. over-crowded traffic, no authorization, ...), the chatbot will auto-reply the pre-configured message.\n\nYou can change it in `src\u002Fchatgpt.js`:\n\n```typescript\nconst chatgptErrorMessage = \"🤖️：ChatGPT摆烂了，请稍后再试～\";\n```\n\n---\n\n### 2.2 Config `OpenAI` Models\n\nYou can change whatever `OpenAI` Models you like to handle task at different capability, time-consumption and expense trade-off. (e.g. model with better capability costs more time to respond)\n\n**Currently, the latest `GPT-4o` model is up and running!**\n\n~~Since the latest `gpt-4` model is currently in a limited beta and only accessible to those who have been granted access, currently we use the `gpt-3.5-turbo` model as default. Of course, if you have the access to `gpt-4` API, you can just change the model to `gpt-4` without any other modification.~~\n\nAccording to OpenAI doc,\n\n> GPT-4o (“o” for “omni”) is our most advanced model. It is multimodal (accepting text or image inputs and outputting text), and it has the same high intelligence as GPT-4 Turbo but is much more efficient—it generates text 2x faster and is 50% cheaper. Additionally, GPT-4o has the best vision and performance across non-English languages of any of our models.\n\n> ~~GPT-3.5 models can understand and generate natural language or code. Our most capable and cost effective model in the GPT-3.5 family is `gpt-3.5-turbo` which has been optimized for chat but works well for traditional completions tasks as well.~~\n\nAlso, for the same model, we can configure dozens of parameter (e.g. answer randomness, maximum word limit...). For example, for the `temperature` field:\n\n> Higher values like **0.8** will make the output more random, while lower values like **0.2** will make it more focused and deterministic.\n\nYou can configure all of them in `src\u002Fchatgpt.js`:\n\n```typescript\nchatgptModelConfig: object = {\n  \u002F\u002F this model field is required\n  model: \"gpt-4o\",\n  \u002F\u002F add your ChatGPT model parameters below\n  temperature: 0.8,\n  \u002F\u002F max_tokens: 2000,\n};\n```\n\nFor more details, please refer to [OpenAI Models Doc](https:\u002F\u002Fbeta.openai.com\u002Fdocs\u002Fmodels\u002Foverview).\n\n---\n\n### 2.3 Config Model Features\n\nYou can change whatever features you like to handle different types of tasks. (e.g. complete text, edit text, generate code...)\n\nCurrently, we use `createChatCompletion()` powered by `gpt-4o` model, which:\n\n> take a series of messages as input, and return a model-generated message as output.\n\nYou can configure in `src\u002Fchatgpt.js`:\n\n```typescript\nconst response = await this.openaiApiInstance.createChatCompletion({\n  ...this.chatgptModelConfig,\n  messages: inputMessages,\n});\n```\n\nFor more details, please refer to [OpenAI API Doc](https:\u002F\u002Fbeta.openai.com\u002Fdocs\u002Fapi-reference\u002Fintroduction).\n\n---\n\n### 2.4 Add Customized Task Handler\n\nYou can add your own task handlers to expand the ability of this chatbot!\n\nIn `src\u002Fchatgpt.ts` `ChatGPTBot.onCustimzedTask()`, write your own task handler:\n\n```typescript\n\u002F\u002F e.g. if a message starts with \"Hello\", the bot sends \"World!\"\nif (message.text().startsWith(\"Hello\")) {\n  await message.say(\"World!\");\n  return;\n}\n```\n\n## 3. Common Errors and Troubleshooting\n\n### 3.1 Assertion Error during Login or Self-chat 🤯\n\n- Error Log:\n\n  ```log\n  uncaughtException AssertionError [ERR_ASSERTION]: 1 == 0\n      at Object.equal (\u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Futil\u002Fglobal.js:53:14)\n      at \u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Fcore.js:195:16\n      at processTicksAndRejections (node:internal\u002Fprocess\u002Ftask_queues:96:5) {\n    code: 2,\n    details: 'AssertionError [ERR_ASSERTION]: 1 == 0\\n' +\n      '    at Object.equal (\u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Futil\u002Fglobal.js:53:14)\\n' +\n      '    at \u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Fcore.js:195:16\\n' +\n      '    at processTicksAndRejections (node:internal\u002Fprocess\u002Ftask_queues:96:5)'\n  }\n  ```\n\n- Solution:\n  - If see this error during login, please check [issue #8](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F8)\n  - If see this error during self-chat, please check [issue #38](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F38)\n\n### 3.2 I can't trigger auto reply 🤔\n- Solution:\n    - Before deployment, read the trigger conditions in [1.1.2 Configure Environment Variables](#112-configure-environment-variables)\n    - After deployment, check the console logs for following lines:\n      - 🎯 Trigger keyword in private chat is: `\u003Ckeyword>`\n      - 🎯 Trigger keyword in group chat is: `@Name \u003Ckeyword>`\n\n## 4. How to Contribute to this Project?\n\nYou are more than welcome to raise some issues, fork this repo, commit your code and submit pull request. And after code review, we can merge your contribution. I'm really looking forward to develop more interesting features!\n\nAlso, there're something in the to-do list for future enhancement:\n\n1. Chat with context (integrate with [`LangChain`](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain)):\n  - Keep track of every on-going conversation for each private chat or group chat\n  - Dynamic drop or summarize the history conversation sent throught API in case the token gets oversized\n  - Set time-out for a conversation when users stop chatting for a while\n2. More AI capability:\n  - Integrate OpenAI `DALL·E` model for AI image creation. Triggered by customized keyword (e.g. Hi bot, draw...)\n  - Integrate OpenAi `Whisper` model for speech recognition. Triggered by voice messages and do transcription or translation\n3. More flexible depolyment:\n  - Make deployment templates on other cloud platforms\n  - Optimize depolyment process to be more robust and compatible on different OS\n\n## 5. Acknowledgement\n\nGreat thanks to:\n\n- [@leoncsyang](https:\u002F\u002Fgithub.com\u002Fleoncsyang) for fixing [Issue #81](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F81)\n- [@hdfk7](https:\u002F\u002Fgithub.com\u002Fhdfk7) for fixing [Issue #67](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F67)\n- [@jichangfeng](https:\u002F\u002Fgithub.com\u002Fjichangfeng) for merging [PR #61](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fpull\u002F61)\n- [@wenle](https:\u002F\u002Fgithub.com\u002Fwenle) for merging [PR #92](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fpull\u002F92), [PR #93](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fpull\u002F93)\n\n## Thanks for your support by starring this project!\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fstargazers\">\n    \u003Cimg src=\"https:\u002F\u002Freporoster.com\u002Fstars\u002Fdark\u002Fnotext\u002Fkx-Huang\u002FChatGPT-on-WeChat\" alt=\"Stargazers repo roster for @kx-Huang\u002FChatGPT-on-WeChat\" \u002F>\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fstargazers\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_3ead1074b1d9.png\" alt=\"Star history chart for @kx-Huang\u002FChatGPT-on-WeChat\"\u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n","# 微信上的ChatGPT ![GitHub License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fkx-huang\u002Fchatgpt-on-wechat?label=License&color=orange) [![wakatime](https:\u002F\u002Fwakatime.com\u002Fbadge\u002Fgithub\u002Fkx-Huang\u002FChatGPT-on-WeChat.svg)](https:\u002F\u002Fwakatime.com\u002Fbadge\u002Fgithub\u002Fkx-Huang\u002FChatGPT-on-WeChat) ![Railway Deploy](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fchecks-status\u002Fkx-huang\u002Fchatgpt-on-wechat\u002Fmaster?logo=railway&style=flat&label=Deploy) ![GitHub Repo stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fkx-huang\u002Fchatgpt-on-wechat?style=social)\n\n\u003C!-- omit in toc -->\n\n🤖️ 将你的微信变成ChatGPT [**只需两步！**](#12-deploy-on-cloud) 🤖️\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_95cddda4806e.png\" alt=\"群聊演示，使用 @kx-Huang\u002FChatGPT-on-WeChat\" \u002F>\n\u003C\u002Fp>\n\n## 功能 \u003C!-- omit in toc -->\n\n本项目基于我之前贡献的[这个超棒的项目](https:\u002F\u002Fgithub.com\u002Ffuergaosi233\u002Fwechat-chatgpt)，结合[`Wechaty SDK`](https:\u002F\u002Fgithub.com\u002Fwechaty\u002Fwechaty)和`OpenAI API`，实现了以下功能：\n\n- 快速且稳定的连接到一组具有不同功能的AI模型，通常是为`ChatGPT`提供支持的`gpt-4o`和`gpt-3.5-turbo`\n- 在云服务器`Railway`上实现稳定、持久且快速的部署\n\n## 0. 目录 \u003C!-- omit in toc -->\n\n- [微信上的ChatGPT    ](#chatgpt-on-wechat----)\n  - [1. 如何部署这个机器人？](#1-how-to-deploy-this-bot)\n    - [1.1 本地部署](#11-deploy-in-local)\n      - [1.1.1 获取你的OpenAI API密钥](#111-get-your-openai-api-keys)\n      - [1.1.2 配置环境变量](#112-configure-environment-variables)\n      - [1.1.3 设置Docker](#113-setup-the-docker)\n      - [1.1.4 登录你的微信](#114-login-your-wechat)\n    - [1.2 Railway上部署](#12-deploy-on-railway)\n      - [1.2.1 在`Railway`上配置](#121-configure-on-railway)\n      - [1.2.2 在`Railway`上部署并登录](#122-deploy--login-on-railway)\n      - [1.2.3 在阿里云ComputeNest上部署](#13-deploy-on-alibaba-cloud-computenest)\n  - [2. 有没有什么高级设置？](#2-any-fancy-advanced-settings)\n    - [2.1 错误回复配置](#21-config-reply-in-error)\n    - [2.2 `OpenAI`模型配置](#22-config-openai-models)\n    - [2.3 模型功能配置](#23-config-model-features)\n    - [2.4 添加自定义任务处理器](#24-add-customized-task-handler)\n  - [3. 常见错误及故障排除](#3-common-errors-and-troubleshooting)\n    - [3.1 登录或自聊时出现断言错误 🤯](#31-assertion-error-during-login-or-self-chat-)\n    - [3.2 我无法触发自动回复 🤔](#32-i-cant-trigger-auto-reply-)\n  - [4. 如何参与本项目的贡献？](#4-how-to-contribute-to-this-project)\n  - [5. 致谢](#5-acknowledgement)\n  - [感谢你通过给本项目加星来支持我们！](#thanks-for-your-support-by-starring-this-project)\n\n## 1. 如何部署这个机器人？\n\n你可以选择**本地部署**或**云端部署**，随你喜好。\n\n推荐使用[云端部署](#12-deploy-on-cloud)的方法。\n\n### 1.1 本地部署\n\n#### 1.1.1 获取你的OpenAI API密钥\n\n- `openaiApiKey`可以在你的OpenAI账户的[**API密钥页面**](https:\u002F\u002Fbeta.openai.com\u002Faccount\u002Fapi-keys)生成。\n- `openaiOrganizationID`是可选的，可以在你的OpenAI账户的[**设置页面**](https:\u002F\u002Fbeta.openai.com\u002Faccount\u002Forg-settings)找到。\n\n---\n\n#### 1.1.2 配置环境变量\n\n你可以将模板文件`config.yaml.example`复制到一个新的文件`config.yaml`中，并填入以下配置：\n\n```yaml\nopenaiApiKey: \"\u003Cyour_openai_api_key>\"\nopenaiOrganizationID: \"\u003Cyour_organization_id>\"\nchatgptTriggerKeyword: \"\u003Cyour_keyword>\"\n```\n\n或者，你也可以将`.env.example`文件中的环境变量导出到你的系统中，这是更推荐的方式，可以更好地保护你的`OpenAI API密钥`：\n\n```bash\nexport OPENAI_API_KEY=\"sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport OPENAI_ORGANIZATION_KEY=\"org-XXXXXXXXXXXXXXX\"\nexport CHATGPT_TRIGGER_KEYWORD=\"Hi bot:\"\n```\n\n**请注意：**\n\n- `chatgptTriggerKeyword`是用于触发自动回复的关键字：\n  - 在私聊中，以该关键字**开头**的消息会触发自动回复。\n  - 在群聊中，以`@名字 \u003C关键字>`**开头**的消息会触发自动回复。\n- 如果`chatgptTriggerKeyword`为空字符串，则表示：\n  - 在私聊中，**所有消息**都会触发自动回复。\n  - 在群聊中，只有**“@机器人”**才会触发自动回复。\n\n---\n\n#### 1.1.3 设置Docker\n\n1. 构建Docker镜像\n\n```bash\ndocker build -t chatgpt-on-wechat .\n```\n\n2. 启动Docker容器\n\n```bash\ndocker run -v $(pwd)\u002Fconfig.yaml:\u002Fapp\u002Fconfig.yaml chatgpt-on-wechat\n```\n\n你也可以使用Docker Compose进行构建：\n\n1. 启动容器\n\n```bash\ndocker-compose up -d\n```\n\n2. 查看二维码以登录微信\n\n```bash\ndocker-compose logs -f\n```\n\n---\n\n#### 1.1.4 登录你的微信\n\n成功部署机器人后，请仔细按照Docker容器终端或日志提示操作：\n\n1. 使用手机微信扫描二维码。\n2. 点击“登录”以允许桌面登录（我们的机器人就运行在桌面上）。\n3. 等待几秒钟，就可以开始聊天了！\n\n🤖 **尽情享受你的强大聊天机器人吧！** 🤖\n\n---\n\n### 1.2 在Railway上部署\n\n点击下方按钮，即可分叉此仓库并在Railway上部署！\n\n[![在Railway上部署](https:\u002F\u002Frailway.app\u002Fbutton.svg)](https:\u002F\u002Frailway.app\u002Fnew\u002Ftemplate\u002FzKIfYk?referralCode=D6wD0x)\n\n---\n\n#### 1.2.1 在`Railway`上配置\n\n请填写以下内容：\n\n1. 你的分叉仓库名称（可以随意命名）。\n2. 选择是否将其设为私有（由你决定）。\n3. 环境变量（关于如何获取OpenAI API密钥，请参考[1.1.1 获取你的OpenAI API密钥](#111-get-your-openai-api-keys)）。\n\n![Railway配置](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_1526a5df6cb8.png)\n\n**请注意：**\n\n务必在Railway平台上设置环境变量，而不是直接写入`config.yaml`文件中。强烈建议不要将你的`OpenAI API密钥`明文写入公开仓库中。任何拥有该密钥的人都可以访问OpenAI的服务，如果你为此付费，可能会导致经济损失。\n\n---\n\n#### 1.2.2 在`Railway`上部署并登录\n\n部署过程是自动化的，首次可能需要几分钟时间。当看到“成功”字样时，点击标签查看详细信息。（这就是你的秘密微信控制台！）\n\n![Railway部署](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_4af48bcab48a.png)\n\n点击“部署日志”，你会看到一切都在准备中，等待二维码弹出。像登录桌面版微信一样扫描它，然后在手机微信上点击“登录”。\n\n![Railway扫描二维码](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_a3278014ebb9.png)\n\n最后，一切就绪！你会看到有人给你发送消息的日志，以及聊天机器人自动回复的记录。\n\n### 1.3 在阿里云 ComputeNest 上部署\n\n在阿里云 ComputeNest 上一键部署：\n\n[![在阿里云 ComputeNest 上部署](doc\u002Fimg\u002Fdeploy_to_computenest.svg)](https:\u002F\u002Fcomputenest.console.aliyun.com\u002Fservice\u002Finstance\u002Fcreate\u002Fdefault?type=user&ServiceName=ChatGPT-on-WeChat社区版)\n\n请按照部署指南，在阿里云上部署 ChatGPT-on-WeChat。支持国内站点和国际站点。\n- [部署指南（国内站点）](https:\u002F\u002Fcomputenest.console.aliyun.com\u002Fservice\u002Fdetail\u002Fcn-hangzhou\u002Fservice-a81e49ab7dd24520a365?isInstance=true)\n- [部署指南（国际站点）](https:\u002F\u002Fcomputenest.console.aliyun.com\u002Fservice\u002Fdetail\u002Fap-southeast-1\u002Fservice-37a1f9f9b9e1482ba61b?isInstance=true)\n\n切换阿里云控制台的语言，即可查看不同语言的指南。\n\n首先，需要提供云资源配置，例如 ECS 实例类型和网络配置。\n![ECS 实例配置](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_80154388f926.png)\n同时还需要设置 ChatGPT-On-WeChat 的软件配置。\n![ChatGPT-On-WeChat 软件配置](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_faa7e4239bdd.png)\n\n确认部署后，阿里云 ComputeNest 将在您的阿里云账号下自动创建 ECS 实例，并部署和启动 ChatGPT-on-WeChat 应用程序。\n\nComputeNest 服务实例部署完成后，请查看“使用说明”以了解如何登录到 ECS 实例。\n![使用说明](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_ed6c72533e7d.png)\n\n在 ECS 工作台中运行命令以获取二维码。\n![二维码](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_db7d74cedb88.png)\n\n像登录桌面版微信一样扫描该二维码，然后在手机微信上点击“登录”。\n\n最后，一切准备就绪！当有人向您发送消息时，您将看到日志记录；每当聊天机器人自动触发回复时，也会有相应的日志显示。\n\n## 2. 是否有高级自定义设置？\n\n### 2.1 配置错误回复\n\n当 OpenAI API 出现某些错误时（例如流量过大、未授权等），聊天机器人将自动回复预先配置的消息。\n\n您可以在 `src\u002Fchatgpt.js` 中进行更改：\n\n```typescript\nconst chatgptErrorMessage = \"🤖️：ChatGPT 摆烂了，请稍后再试～\";\n```\n\n---\n\n### 2.2 配置 `OpenAI` 模型\n\n您可以根据不同的能力、耗时和成本权衡，选择任何您喜欢的 `OpenAI` 模型来处理任务。（例如，能力更强的模型响应时间更长）\n\n**目前，最新的 `GPT-4o` 模型已经上线并运行！**\n\n~~由于最新的 `gpt-4` 模型目前仍处于有限的测试阶段，仅对获得访问权限的用户开放，因此我们目前默认使用 `gpt-3.5-turbo` 模型。当然，如果您拥有 `gpt-4` API 的访问权限，只需将模型更改为 `gpt-4` 即可，无需其他修改。~~\n\n根据 OpenAI 官方文档，\n\n> GPT-4o（“o”代表“omni”，即多模态）是我们最先进的模型。它支持多模态输入（文本或图像输入，输出文本），并且具有与 GPT-4 Turbo 相同的高智能，但效率更高——生成文本的速度是前者的两倍，价格也便宜 50%。此外，GPT-4o 在视觉能力和非英语语言表现方面，均优于我们现有的其他模型。\n\n> ~~GPT-3.5 系列模型可以理解和生成自然语言或代码。GPT-3.5 系列中最强大且最具成本效益的模型是 `gpt-3.5-turbo`，它专为聊天优化，但也适用于传统的完成任务。~~\n\n此外，对于同一模型，我们还可以配置数十种参数（例如回答的随机性、最大字数限制等）。以 `temperature` 参数为例：\n\n> 较高的值，如 **0.8**，会使输出更具随机性；而较低的值，如 **0.2**，则会使输出更加专注和确定性。\n\n您可以在 `src\u002Fchatgpt.js` 中配置所有这些参数：\n\n```typescript\nchatgptModelConfig: object = {\n  \u002F\u002F 此模型字段为必填项\n  model: \"gpt-4o\",\n  \u002F\u002F 在下方添加您的 ChatGPT 模型参数\n  temperature: 0.8,\n  \u002F\u002F max_tokens: 2000,\n};\n```\n\n更多详细信息，请参阅 [OpenAI 模型文档](https:\u002F\u002Fbeta.openai.com\u002Fdocs\u002Fmodels\u002Foverview)。\n\n---\n\n### 2.3 配置模型功能\n\n您可以根据不同的任务类型，选择所需的模型功能。（例如，完成文本、编辑文本、生成代码等）\n\n目前，我们使用由 `gpt-4o` 模型驱动的 `createChatCompletion()` 方法，其功能为：\n\n> 接受一系列消息作为输入，并返回由模型生成的消息作为输出。\n\n您可以在 `src\u002Fchatgpt.js` 中进行配置：\n\n```typescript\nconst response = await this.openaiApiInstance.createChatCompletion({\n  ...this.chatgptModelConfig,\n  messages: inputMessages,\n});\n```\n\n更多详细信息，请参阅 [OpenAI API 文档](https:\u002F\u002Fbeta.openai.com\u002Fdocs\u002Fapi-reference\u002Fintroduction)。\n\n---\n\n### 2.4 添加自定义任务处理器\n\n您可以添加自己的任务处理器，以扩展此聊天机器人的功能！\n\n在 `src\u002Fchatgpt.ts` 的 `ChatGPTBot.onCustimzedTask()` 中，编写您自己的任务处理器：\n\n```typescript\n\u002F\u002F 例如，如果消息以“Hello”开头，机器人会回复“World！”\nif (message.text().startsWith(\"Hello\")) {\n  await message.say(\"World!\");\n  return;\n}\n```\n\n## 3. 常见错误及故障排除\n\n### 3.1 登录或自聊时出现断言错误 🤯\n\n- 错误日志：\n\n  ```log\n  uncaughtException AssertionError [ERR_ASSERTION]: 1 == 0\n      at Object.equal (\u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Futil\u002Fglobal.js:53:14)\n      at \u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Fcore.js:195:16\n      at processTicksAndRejections (node:internal\u002Fprocess\u002Ftask_queues:96:5) {\n    code: 2,\n    details: 'AssertionError [ERR_ASSERTION]: 1 == 0\\n' +\n      '    at Object.equal (\u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Futil\u002Fglobal.js:53:14)\\n' +\n      '    at \u002Fapp\u002Fnode_modules\u002Fwechat4u\u002Fsrc\u002Fcore.js:195:16\\n' +\n      '    at processTicksAndRejections (node:internal\u002Fprocess\u002Ftask_queues:96:5)'\n  }\n  ```\n\n- 解决方案：\n  - 如果在登录时遇到此错误，请查看 [issue #8](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F8)\n  - 如果在自聊时遇到此错误，请查看 [issue #38](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F38)\n\n### 3.2 无法触发自动回复 🤔\n- 解决方案：\n    - 部署前，请阅读 [1.1.2 配置环境变量](#112-configure-environment-variables) 中的触发条件。\n    - 部署后，请检查控制台日志中是否有以下内容：\n      - 🎯 私聊中的触发关键词为：\u003Ckeyword>\n      - 🎯 群聊中的触发关键词为：@Name \u003Ckeyword>\n\n## 4. 如何为本项目贡献力量？\n\n非常欢迎您提出问题、fork 本仓库、提交代码并发起 Pull Request。在代码审查通过后，我们将合并您的贡献。我非常期待与大家一起开发更多有趣的功能！\n\n此外，我们还有一些待办事项，计划在未来进行优化：\n\n1. 带上下文的聊天（集成 [`LangChain`](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain)）：\n   - 为每个私聊或群聊维护当前会话的完整记录\n   - 当对话历史过长导致 token 数量超出限制时，动态裁剪或总结历史对话并通过 API 发送\n   - 在用户一段时间未回复时，为会话设置超时机制\n\n2. 更多 AI 能力：\n   - 集成 OpenAI 的 `DALL·E` 模型，用于 AI 图像生成。可通过自定义关键词触发（例如：Hi bot, draw...）\n   - 集成 OpenAI 的 `Whisper` 模型，实现语音识别功能。可对语音消息进行转录或翻译\n\n3. 更灵活的部署方式：\n   - 制作适用于其他云平台的部署模板\n   - 优化部署流程，使其更加健壮，并提高在不同操作系统上的兼容性\n\n## 5. 致谢\n\n特别感谢以下贡献者：\n\n- [@leoncsyang](https:\u002F\u002Fgithub.com\u002Fleoncsyang) 修复了 [Issue #81](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F81)\n- [@hdfk7](https:\u002F\u002Fgithub.com\u002Fhdfk7) 修复了 [Issue #67](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F67)\n- [@jichangfeng](https:\u002F\u002Fgithub.com\u002Fjichangfeng) 合并了 [PR #61](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fpull\u002F61)\n- [@wenle](https:\u002F\u002Fgithub.com\u002Fwenle) 合并了 [PR #92](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fpull\u002F92) 和 [PR #93](https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fpull\u002F93)\n\n## 感谢您通过 Star 本项目给予的支持！\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fstargazers\">\n    \u003Cimg src=\"https:\u002F\u002Freporoster.com\u002Fstars\u002Fdark\u002Fnotext\u002Fkx-Huang\u002FChatGPT-on-WeChat\" alt=\"@kx-Huang\u002FChatGPT-on-WeChat 的 Star 收集器\" \u002F>\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fstargazers\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_readme_3ead1074b1d9.png\" alt=\"@kx-Huang\u002FChatGPT-on-WeChat 的 Star 历史曲线图\"\u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>","# ChatGPT-on-WeChat 快速上手指南\n\n将你的微信变成由 GPT-4o 或 GPT-3.5-turbo 驱动的聊天机器人，只需简单几步即可部署。\n\n## 1. 环境准备\n\n在开始之前，请确保满足以下前置条件：\n\n*   **操作系统**：Linux、macOS 或 Windows（需安装 Docker）。\n*   **核心依赖**：已安装 [Docker](https:\u002F\u002Fwww.docker.com\u002F) 和 [Docker Compose](https:\u002F\u002Fdocs.docker.com\u002Fcompose\u002F)。\n*   **账号要求**：\n    *   有效的 **微信账号**（用于扫码登录）。\n    *   **OpenAI API Key**：可在 [OpenAI API Keys 页面](https:\u002F\u002Fbeta.openai.com\u002Faccount\u002Fapi-keys) 获取。\n    *   （可选）OpenAI Organization ID：可在 [Settings 页面](https:\u002F\u002Fbeta.openai.com\u002Faccount\u002Forg-settings) 获取。\n\n## 2. 安装与配置\n\n本项目推荐使用 **Docker** 进行本地部署，既安全又便捷。\n\n### 第一步：获取配置文件\n\n克隆项目或直接创建配置文件。将示例配置 `config.yaml.example` 复制为 `config.yaml`：\n\n```bash\ncp config.yaml.example config.yaml\n```\n\n### 第二步：编辑配置\n\n使用文本编辑器打开 `config.yaml`，填入你的 OpenAI 密钥和触发关键词：\n\n```yaml\nopenaiApiKey: \"sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nopenaiOrganizationID: \"org-XXXXXXXXXXXXXXX\" \nchatgptTriggerKeyword: \"Hi bot:\"\n```\n\n**配置说明：**\n*   `openaiApiKey`: 必填，你的 OpenAI API 密钥。\n*   `chatgptTriggerKeyword`: 触发自动回复的关键词。\n    *   **私聊**：消息以该关键词开头即触发。\n    *   **群聊**：消息格式为 `@机器人昵称 \u003C关键词>` 时触发。\n    *   若设为空字符串 `\"\"`：私聊中所有消息均触发；群聊中仅当 `@机器人昵称` 时触发。\n\n> **安全提示**：也可以选择不修改 yaml 文件，而是通过导出环境变量方式配置（推荐用于生产环境）：\n> ```bash\n> export OPENAI_API_KEY=\"sk-...\"\n> export CHATGPT_TRIGGER_KEYWORD=\"Hi bot:\"\n> ```\n\n### 第三步：构建并运行\n\n在项目根目录下执行以下命令构建镜像并启动容器：\n\n**方式 A：使用 Docker 命令**\n\n1.  构建镜像：\n    ```bash\n    docker build -t chatgpt-on-wechat .\n    ```\n2.  运行容器（挂载配置文件）：\n    ```bash\n    docker run -v $(pwd)\u002Fconfig.yaml:\u002Fapp\u002Fconfig.yaml chatgpt-on-wechat\n    ```\n\n**方式 B：使用 Docker Compose（推荐）**\n\n1.  启动服务：\n    ```bash\n    docker-compose up -d\n    ```\n2.  查看日志以获取登录二维码：\n    ```bash\n    docker-compose logs -f\n    ```\n\n## 3. 基本使用\n\n部署成功后，按照终端或 Docker 日志中的提示进行操作：\n\n1.  **扫码登录**：\n    在日志中找到显示的二维码图片（或在 Railway\u002F云服务器控制台查看），使用手机微信扫描该二维码。\n2.  **确认登录**：\n    在手机微信上点击“登录”按钮（允许网页\u002F桌面端登录）。\n3.  **开始对话**：\n    登录成功后，机器人即开始运行。\n    *   **私聊测试**：发送 `Hi bot: 你好`（假设关键词为 `Hi bot:`），机器人将调用 OpenAI 接口回复。\n    *   **群聊测试**：在群内 `@机器人昵称 Hi bot: 今天天气如何`，机器人将回复。\n\n此时，你已成功拥有一个基于大模型的微信智能助手！","某跨境电商运营团队每天需在微信上处理大量海外客户咨询，涉及多语言回复、产品参数查询及售后政策解释。\n\n### 没有 ChatGPT-on-WeChat 时\n- 客服人员需频繁切换电脑端网页版 ChatGPT 复制粘贴答案，响应延迟高达 5-10 分钟，导致客户流失。\n- 遇到英语、西班牙语等小语种咨询时，人工翻译耗时且易出错，常因表达不地道引发误解。\n- 深夜或节假日无人值班时，客户消息石沉大海，无法获得即时反馈，严重影响品牌信誉。\n- 重复性高的基础问题（如“发货时间”、“退换货流程”）占用了客服 80% 的精力，难以聚焦复杂客诉。\n- 团队协作混乱，不同客服对同一问题的回答标准不一，缺乏统一的知识库支撑。\n\n### 使用 ChatGPT-on-WeChat 后\n- 部署机器人仅需两步云端配置，客户在微信发送消息即刻获得基于 GPT-4o 的精准回复，响应时间缩短至秒级。\n- 内置多语言能力自动识别并流畅回复英、西、法等十余种语言，消除沟通障碍，提升海外客户满意度。\n- 实现 7×24 小时全天候自动值守，无论深夜还是假期，客户都能第一时间获得标准化的业务解答。\n- 通过设置触发关键词（如\"Hi bot:\"），机器人自动拦截并处理 80% 的常见重复问题，释放人力专注高价值服务。\n- 统一配置模型参数与回复策略，确保全团队对外输出内容一致、专业，有效维护品牌形象。\n\nChatGPT-on-WeChat 将微信瞬间升级为智能客服中枢，以极低门槛实现了企业级 AI 自动化服务能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkx-Huang_ChatGPT-on-WeChat_1526a5df.png","kx-Huang","Kexuan Huang","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fkx-Huang_3e288f76.jpg","Software Engineer @Apple 🧑‍💻 \r\nAlumni @Umich @SJTU 🧑‍🎓\r\nBadminton Athlete 🏸\r\nPomsky Dad 🐶","Apple","Cupertino",null,"kx-huang.github.io","https:\u002F\u002Fgithub.com\u002Fkx-Huang",[86,90],{"name":87,"color":88,"percentage":89},"TypeScript","#3178c6",95,{"name":91,"color":92,"percentage":93},"Dockerfile","#384d54",5,910,376,"2026-04-06T10:02:09","ISC","未说明","不需要 GPU",{"notes":101,"python":98,"dependencies":102},"该项目基于 Node.js 和 Wechaty SDK 开发，主要通过 Docker 容器化部署（支持本地或 Railway、阿里云 ComputeNest 等云平台）。运行核心依赖是 OpenAI API Key 和微信账号扫码登录，无需本地安装 Python 环境或下载大型模型文件，也不依赖 GPU 算力。",[103,104,105,106],"Wechaty SDK","OpenAI API","Docker","Node.js (隐含依赖)",[15],[109,110,111,112],"chatgpt","wechat-bot","gpt-4","railway-app","2026-03-27T02:49:30.150509","2026-04-08T17:20:27.594978",[116,121,126,131,136,140,145,150],{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},24868,"在 Railway 部署后，日志中的登录二维码太模糊无法扫描怎么办？","日志中除了显示模糊的二维码图片外，通常还会包含一个链接。请直接点击该链接，浏览器会打开一个清晰的二维码页面供扫描登录。","https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F3",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},24869,"如何设置 ChatGPT 的人格预设或对话背景（System Prompt）？","可以修改源代码 src\u002Fchatgpt.ts 文件的第 52 行。该行字符串定义了对话背景，你可以将其修改为任何你喜欢的情境描述（支持中文）。修改完成后，需要重新编译项目并重启服务才能生效。","https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F74",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},24870,"找不到 config.yaml.example 文件或新建 config.yaml 后仍报错怎么办？","项目中通常包含一个名为 config.yaml.example 的模板文件。你需要将该文件重命名为 config.yaml（或者手动新建一个名为 config.yaml 的文件），然后在其中填入你的 API Key 等配置信息。确保文件位于项目根目录下。","https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F73",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},24871,"运行时报错 'Code 401: Unauthorized' 或 'Incorrect API key provided: undefined' 如何解决？","这表示 OpenAI API 密钥未正确配置。请检查你的 config.yaml 配置文件，确保 openaiApiKey 字段已填入正确的密钥值，且没有多余的空格或引号错误。如果是在环境变量中配置，请确认变量名是否正确加载。","https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F6",{"id":137,"question_zh":138,"answer_zh":139,"source_url":135},24872,"部署后出现 'AssertionError [ERR_ASSERTION]: 1 == 0' 或微信登录失败怎么办？","这通常是由于微信网页版协议限制或网络环境问题导致的。如果是国内服务器部署，可能需要配置网络代理以连接微信服务器。此外，确保使用的是最新版本的代码，因为维护者会不定期修复 wechat4u 相关的兼容性问题。",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},24873,"在国内环境部署出现 'connect ETIMEDOUT' 连接超时错误如何解决？","由于网络限制，直接连接 OpenAI 或微信服务器可能会超时。解决方案包括：1. 将项目部署在海外服务器上；2. 自行搭建 OpenAI 请求的反向代理，并在配置文件中指定代理地址；3. 使用他人搭建的合法合规的代理中转服务。","https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F76",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},24874,"如何在本地开发环境中调试该项目？","如果使用 VS Code，可以通过配置 launch.json 进行调试。确保安装了必要的扩展（如 TypeScript Debugger），并在调试配置中指定入口文件（如 src\u002Fmain.ts）和相应的运行时参数。具体配置可参考项目文档或社区分享的调试配置。","https:\u002F\u002Fgithub.com\u002Fkx-Huang\u002FChatGPT-on-WeChat\u002Fissues\u002F23",{"id":151,"question_zh":152,"answer_zh":153,"source_url":120},24875,"Railway 部署时遇到 Node.js 依赖冲突导致构建失败怎么办？","这通常是因为安装 nodejs 和 npm 包时出现了依赖版本冲突。建议检查并修改 Dockerfile 中的依赖安装步骤，或者参考社区中成功部署的 Fork 仓库（如 leoncsyang 的仓库）中的 Dockerfile 配置进行调整。",[]]