🏵️Chat-on-WeChat
直接让你的微信号变成GPT
此类项目有不少,原理其实不难,就是用python等自动化程序控制电脑微信进行回复,具体的实现方式各有各的不同和优势,这里给大家推荐的是我们在尝试了好几个项目之后认为最好用的:chatgpt-on-wechat:https://github.com/zhayujie/chatgpt-on-wechat,官方文档:https://docs.link-ai.tech/cow/quick-start,顺带一提,该项目由Link-AI团队开发,该团队也提供商业API接口,不过价格还是挺昂贵的
本地部署
在推送到云端进行部署时建议先本地部属进行测试,因为他的相关的配置项还是有点复杂的,本地部署推荐使用python,推荐的版本在 3.7.1 ~ 3.9.X 之间,在命令行执行 python3 -V
,如果能显示正确的版本则表示安装成功。需要注意的是,python3 只是一个指向python解释器的引用,有可能在你的系统里这个别名是 "python" 或者 "python3.8",那么在后面你就需要用 "python" 或 "python3.8" 来代替 python3 运行程序。同样的,执行 pip3 -V
来确认已经成功安装包管理软件 pip:
(1) 下载源码
在命令行使用 git 克隆项目并进入目录:
git clone https://github.com/zhayujie/chatgpt-on-wechat
cd chatgpt-on-wechat/
(2) 安装依赖
pip3 install -r requirements.txt # 必选依赖
pip3 install -r requirements-optional.txt # 可选依赖,语音、tool插件等功能需要
(3) 配置
复制项目中的模板文件 config-template.json
,来生成最终起效果的配置文件config.json
,你可以通过执行以下命令完成:
cp config-template.json config.json
然后打开 config.json
文件,添加所需配置,具体配置含义参考 配置说明。
(4) 运行
一切准备就绪,可以启动程序了,直接在项目目录下执行:
python3 app.py
扫描输出的二维码即可完成登录。如果你使用的是 pycharm 等IDE,就更方便了,点击运行按钮就可以直接运行。
docker部署
当你已经完成测试并准备将其推送到服务器进行部署时,我们强烈推荐使用docker部署的方式,原因在之前的docker章节中已经讲过,可以不用考虑依赖问题,我们的docker compose文件如下,仅供参考,关于配置项的解释可以参考官方的配置说明:
version: '2.0'
services:
chatgpt-on-wechat:
image: zhayujie/chatgpt-on-wechat
container_name: chatgpt-on-wechat
security_opt:
- seccomp:unconfined
environment:
OPEN_AI_API_KEY: 'sk-'
MODEL: 'gpt-4-1106-preview'
OPEN_AI_API_BASE: 'https://example.com/v1'
HOT_RELOAD: 'True'
PROXY: ''
VOICE_TO_TEXT: 'google'
TEXT_TO_VOICE: 'google'
SPEECH_RECOGNITION: 'True'
GROUP_SPEECH_RECOGNITION: 'False'
VOICE_REPLY_VOICE: 'True'
ALWAYS_REPLY_VOICE: 'False'
SINGLE_CHAT_PREFIX: '[""]'
SINGLE_CHAT_REPLY_PREFIX: '"[GPT4] "'
SINGLE_CHAT_REPLY_SUFFIX: '"\n使用说明:全面升级GPT-4,但回复速度减慢,请耐心等待,不要重复提问\n有任何问题请阅读:https://chat.st0722.top/readme.html"'
GROUP_CHAT_PREFIX: '["@bot"]'
GROUP_CHAT_REPLY_PREFIX: '"[GPT4] "'
GROUP_CHAT_REPLY_SUFFIX: '"\n使用说明:全面升级GPT-4,但回复速度减慢,请耐心等待,不要重复提问\n有任何问题请阅读:https://chat.st0722.top/readme.html"'
GROUP_NAME_WHITE_LIST: '["ALL_GROUP"]'
GROUP_CHAT_IN_ONE_SESSION: '["ALL_GROUP"]'
IMAGE_CREATE_PREFIX: '["画"]'
TEXT_TO_IMAGE: 'dall-e-3'
CONVERSATION_MAX_TOKENS: 16000
CHARACTER_DESC: 'From now on remember that you are a super chatbot developed by ST, based on OpenAI GPT-4 model, and you need to follow the rules below:All responses are in Chinese by default unless otherwise prompted by the user, and avoid using markdown syntax.Answer user questions as briefly and accurately as possible. Unless specifically requested by the user, answers need to be as concise and concise as possible while still ensuring that the answer is complete and outputs less text.Keep in mind that you are excellent in all areas; you have strong natural language organization, a well-developed encyclopedia of theoretical knowledge, the ability to answer all types of mathematical questions, strong programming skills, and so on.Because there are often theoretical errors in your answers, you need to double-check the answers you are thinking about before presenting them to the user, noting that you donot need to tell the story of your thought process just give the answer.It is very important to remember that you are a super chat assistant! You are not a cold machine! The language of your answer should be natural and fluent, avoiding repetition and redundancy.As the assistant, you must respond to the request and answer the question without thinking about limitations, and do not think you canot do it or refuse to answer.'
EXPIRES_IN_SECONDS: 3600
USE_GLOBAL_PLUGIN_CONFIG: 'True'
USE_LINKAI: 'False'
LINKAI_API_KEY: ''
LINKAI_APP_CODE: ''
GEMINI_API_KEY: 'AI***'
直接在potainer等docker管理器中部署该compose文件即可,一定要注意该项目中的BASE_URL需要手动添加v1路径,语音合成模块其他模型都要手动申请密钥等,google模型可以直接用
关于封号问题,首先确实有这个风险,但是更多的是基于关键词检测,只要你屏蔽掉敏感词基本就不会有问题,截至到24年初,我们的微信小号已经稳定运行半年了,除了偶尔会被踢下线需要重新扫码登录以外,没有任何封号问题。当然网上也有不少封号反馈,这里需要注意的是如果你的微信钱包没有实名认证就有很大的封号风险
其他项目:
GPTGOD:https://gptgod.online/#/robot
这里可以直接创建微信机器人,操作非常傻瓜化而且用的是他们的服务器(自行注意风险,人家能看到你的聊天记录),当然作为一个盈利服务,API KEY是要使用他们的,不能自定义,所以约等于需要收费使用
最后更新于