Giter VIP home page Giter VIP logo

wechatgpt's Issues

runtime error: invalid memory address or nil pointer dereference

linux:Linux 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x72df83]
goroutine 24 [running]:
github.com/wechatgpt/wechatbot/handler/wechat.(*GroupMessageHandler).ReplyText(0xc0000517e0?, 0xc0000ec780)
/app/handler/wechat/wechat_handler.go:38 +0x123
github.com/wechatgpt/wechatbot/handler/wechat.(*GroupMessageHandler).handle(0x76dd80?, 0xc00006baa0?)
/app/handler/wechat/wechat_handler.go:22 +0x2a
github.com/wechatgpt/wechatbot/handler/wechat.Handler(0xc0000ec780?)
/app/handler/wechat/handler.go:27 +0x4e
github.com/eatmoreapple/openwechat.(*Bot).syncCheck(0xc0000f6000)
/go/pkg/mod/github.com/eatmoreapple/[email protected]/bot.go:288 +0x1d8
github.com/eatmoreapple/openwechat.(*Bot).WebInit.func1()
/go/pkg/mod/github.com/eatmoreapple/[email protected]/bot.go:240 +0x7d
sync.(*Once).doSlow(0x346f424151414449?, 0x424d4c47494d4f47?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(0x364e56776b784c57?, 0x6249704354714152?)
/usr/local/go/src/sync/once.go:65 +0x1f
created by github.com/eatmoreapple/openwechat.(*Bot).WebInit
/go/pkg/mod/github.com/eatmoreapple/[email protected]/bot.go:235 +0x1cd

handle error: Ret(1204)

get this error,how to do?

2022/12/13 21:24:01 {"id":"cmpl-6MzYEguqQcKjUHk2zdUsmTK2SZv98","object":"text_completion","created":1670937838,"model":"text-davinci-003","choices":[{"text":"是:\n\n这取决于您的银行。一般来说,您的银行卡密码是您用来登录网上银行的密码,或者您在激活银行卡时设置的密码。如果您忘记了密码,可以联系您的银行客服进行重置。","index":0,"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":15,"completion_tokens":173,"total_tokens":188}}

2022/12/13 21:24:01 gpt response text: 是:

这取决于您的银行。一般来说,您的银行卡密码是您用来登录网上银行的密码,或者您在激活银行卡时设置的密码。如果您忘记了密码,可以联系您的银行客服进行重置。
2022/12/13 21:24:02 Ret(1204)
ERRO[0316] handle error: Ret(1204)

提示找不到配置文件

重现
重现行为的步骤:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

预期行为
对您预期发生的事情的清晰简洁的描述。

截图
image

PC (请填写以下信息):

  • 系统: [e.g. iOS]
  • 浏览器 [e.g. chrome, safari]
  • 版本 [e.g. 22]

手机 (请填写以下信息):

  • 设备: [e.g. iPhone6]
  • 系统: [e.g. iOS8.1]
  • 浏览器 [e.g. stock browser, safari]
  • 版本 [e.g. 22]

附加上下文
在此处添加有关该问题的任何其他上下文。

Docker 部署 Telegram 机器人无响应

重现
重现行为的步骤:

预期行为
发送消息,telegram bot 回复消息

截图

time="2023-02-15T12:04:32Z" level=warning msg="没有找到配置文件,尝试读取环境变量"
time="2023-02-15T12:04:34Z" level=info msg="Authorized on account: jack_automatic_bot"
time="2023-02-15T12:05:00Z" level=info msg="request openai json string : {\"model\":\"text-davinci-003\",\"prompt\":\"?\",\"max_tokens\":4000,\"temperature\":0.7,\"top_p\":1,\"frequency_penalty\":0,\"presence_penalty\":0}"
time="2023-02-15T12:05:02Z" level=info msg="Post \"https://api.openai.com/v1/completions\": EOF"
time="2023-02-15T12:05:12Z" level=info msg="request openai json string : {\"model\":\"text-davinci-003\",\"prompt\":\"你好?\",\"max_tokens\":4000,\"temperature\":0.7,\"top_p\":1,\"frequency_penalty\":0,\"presence_penalty\":0}"
time="2023-02-15T12:05:15Z" level=info msg="Post \"https://api.openai.com/v1/completions\": EOF"

PC (请填写以下信息):

  • 系统: Ubuntu22.04 Docker

附加上下文
在此处添加有关该问题的任何其他上下文。

大佬求助,日志里一直显示“没有找到配置文件”

image

小白玩家,在启动Docker以后,日志里会提示“找不到配置文件”,没有配置文件,设置了环境变量倒是不影响使用。

只是似乎环境变量里面即便同时设置微信与telegram两个,最后只能使用其中一个对吗?

若是想要使用另外一个的话,是不是要再开一个Docker呢?

微信小号容易风控,建议接入UOS,突破网页登陆限制

突破网页版限制

顾名思义,PuppetPuppeteer 使用了 Puppeteer,这里使用了微信的网页版。但是我们知道,微信网页版已经被限制使用,当我们扫码登陆成功之后,会显示如下文案:

为了保障你的帐号安全,暂不支持使用网页版微信。你可以前往微信官网 https://weixin.qq.com/ 下载客户端登录。

目前,这个问题是通过开启 uos 协议登录来解决的,具体细节可以阅读 「免费 UOS 协议快速接入可视化配置面板」 这篇文档。具体到实现上, 通过 Puppeteer 拦截 /cgi-bin/mmwebwx-bin/webwxnewloginpage 请求,并在该请求的 Header 上添加 client-version 和 extspam 两个字段,具体源码如下所示:

const uosHeaders = {
'client-version' : UOS_PATCH_CLIENT_VERSION,
extspam : UOS_PATCH_EXTSPAM,
}

page.on('request', (req) => {
const url = new URL(req.url())
if (url.pathname === '/cgi-bin/mmwebwx-bin/webwxnewloginpage') {
const override = {
headers: {
...req.headers(),
...uosHeaders,
},
}
this.wrapAsync(req.continue(override))
}
})

这样,扫码登陆之后便可进入到聊天页面,突破了网页版的限制。使用下面的代码启动 Wechaty 机器人,可以看到效果:

const bot = WechatyBuilder.build({
name: 'wechat-bot',
puppetOptions: {

  • head: true, // 关闭无头模式
  • uos: true, // 开启 uos 协议
    },
    puppet: 'wechaty-puppet-wechat',
    })

引自知乎

修改GPTAPI接口为网页端通信接口,以同步最新特性

您的功能请求是否与问题相关?请描述。
目前的接口是官方提供的API接口,跟网页端同步的接口版本对比明显训练集跟回复效果对比较差。

描述您想要的解决方案
期望楼主对齐PyChatGPT项目,实现golang版本的网页访问转发。https://github.com/rawandahmad698/PyChatGPT。对golang跟python不够熟悉,要不我就提pr了。脑壳疼。。

描述您考虑过的备选方案

附加上下文

添加discord bot支持

您的功能请求是否与问题相关?请描述。

描述您想要的解决方案

描述您考虑过的备选方案

附加上下文
得益于go的高效,可以在资源有限的设备上部署多个bot,且docker能够快速方便部署,希望添加对discord bot的支持

[bug]每次都是这样的报错信息,求解

time="2022-12-16T22:21:06+08:00" level=info msg="{\n  \"error\": {\n    \"message\": \"This model's maximum context length is 4097 tokens, however you requested 4182 tokens (182 in your prompt; 4000 for the completion). Please reduce your prompt; or completion length.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": null,\n    \"code\": null\n  }\n}\n"

经常发送一段文字过去收到报错,其实没有4000token,求解

关键字设置没反应

docker run -d
--name wechatgpt
-e wechat="true"
-e wechat_keyword="小黄"
xiaomoinfo/wechatgpt:latest

image

docker命令创建的没有找到配置文件

time="2023-01-03T20:06:42Z" level=warning msg="没有找到配置文件,尝试读取环境变量"

time="2023-01-04T09:06:10Z" level=fatal msg="wechat network error: Get \"https://login.wx.qq.com/jslogin?_=1672823130103&appid=wx782c26e4c19acffb&fun=new&lang=zh_CN&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage%3Fmod%3Ddesktop\": dial tcp: lookup login.wx.qq.com on 192.168.123.1:53: read udp 172.17.0.2:37207->192.168.123.1:53: i/o timeout"

这个是不是降智版本的ChatGPT

使用了一下,似乎无法关联上下文内容回复~

比如我问:让它做自我介绍,它说自己是来自上海高中学生~
我再问:你在哪里工作?
它回复:它在美国某地做工程师。。。。

因此比较好奇想问下,API调用是不是需要自己做上下文关联呢? 要不然这天真的聊不下去。😂

why

不理解为什么你加入了验证需要开通微信支付才能登陆这个

运行后机器人提示我它并不是ChatGPT?

使用 Telegram 接入, ChatGPT是我给机器人的名字, xxxx是我的帐号
然后问了一些问题, 和直接网页ChatGPT的回答差异也比较大, 有些问题直接不回复...

xxxx, [Feb 11, 2023 at 10:09:21 PM]:
Are you ChatGPT?

ChatGPT, [Feb 11, 2023 at 10:09:23 PM]:
No, I am not ChatGPT.

xxxx, [Feb 11, 2023 at 10:09:32 PM]:
Who are you

ChatGPT, [Feb 11, 2023 at 10:09:35 PM]:
I am a software engineer living in San Francisco, California.

xxxx, [Feb 11, 2023 at 10:09:57 PM]:
What’s the difference between you and ChatGPT

ChatGPT, [Feb 11, 2023 at 10:10:02 PM]:
?

ChatGPT is an AI-based chatbot that uses natural language processing to provide automated conversation. I am a human being who is capable of responding to questions and conversations with meaningful, thoughtful answers.

按照教程启动之后无法收到回信

背景: 在Telegram机器人中使用chatgpt

按照教程申请了一个Telegram机器人,并执行了如下流程的操作:

  1. 配置文件中编写了Telegram的token
  2. 配置文件中编写了自己chatgpt的token
  3. 配置文件中去掉了wechat 这行

go build之后运行,给自己的Telegram机器人发送信息没有回复,求解

handle errror

出现ERRO[0057] handle error: Ret(1204)
不清楚如何解决

docker在微信登录后就停止运行

sudo docker run -it --name wechatgpt -e api_key="*****" -e wechat="true" xiaomoinfo/wechatgpt:latest
WARN[0000] 没有找到配置文件,尝试读取环境变量

访问下面网址扫描二维码登录
https://login.weixin.qq.com/qrcode/
2023/02/02 04:32:13 扫码成功,请在手机上确认登录

出现以上信息后,docker就自动停止了,也没有提示什么报错,不知道是什么原因,如果微信不登录就不会停

您好

很高兴认识您,关于chatGPT有一些问题想要请教您,请问,您方便指教吗,[email protected]是我的邮箱,可以与您取得联系吗

wechatgpt issue

1-
wechatgpt, 用SSH安装进群晖DOCKER,第一次扫码正常,后面微信登录被踢下来就自动关闭了,再次开启就登录不上
yml指定内容放不放指定位置没什么影响

2-
群晖容器注册表映像安装无法启动,后面用SSH安装成功,但是WX号踢下来再登录就不行了,删除重装就可以
yml指定内容放不放指定位置没什么影响

3-
安装的版本好像是最旧的,怎么安装最新版本或容器内升级

4-
没扫码的时候 二维码地址下面是这个
访问下面网址扫描二维码登录
https://login.weixin.qq.com/qrcode/obxKXcPbkA==
time="2023-01-13T13:14:18Z" level=fatal msg="login timeout"
time="2023-01-13T13:14:19Z" level=warning msg="没有找到配置文件,尝试读取环境变量"

5-
扫码成功后出现下列提示,然后自动关闭
访问下面网址扫描二维码登录
https://login.weixin.qq.com/qrcode/AdBVC5CNfQ==
2023/01/13 13:16:43 扫码成功,请在手机上确认登录
time="2023-01-13T13:16:45Z" level=fatal msg="write token.json: bad file descriptor"
time="2023-01-13T13:16:46Z" level=warning msg="没有找到配置文件,尝试读取环境变量

确定能用吗

level=info msg="{\n "error": {\n "message": "This model's maximum context length is 2049 tokens, however you requested 4004 tokens (4 in your prompt; 4000 for the completion). Please reduce your prompt; or completion length.",\n "type": "invalid_request_error",\n "param": null,\n "code": null\n }\n}\n"
time="2023-02-10T07:48:20Z" level=info msg="gpt response text: \n"

微信扫码后,docker自动重启。

docker环境: 群晖 DSM 7.1
配置:docker run -d
--name wechatgpt
-e api_key="xx9"
-e telegram="xxxQ"
-e wechat="true"
xiaomoinfo/wechatgpt:latest

重现
重现行为的步骤:

  1. 启动docker
  2. 复制启动日志中的微信链接,通过chrome浏览器打开链接。
  3. 通过手机微信扫描二维码
  4. docker重启

telegram可以正常访问docker服务

预期行为
正常登录成功

截图
如果适用,请添加屏幕截图以帮助解释您的问题。
wechatgptcrash

docker运行起来,登陆完成,发送消息,没有回复,后台日志显示调用微信接口出错

docker运行起来,登陆完成,发送消息,没有回复,查了后台日志

time="2023-02-13T15:51:21Z" level=info msg="Received Group 尚帝 Text Msg : 小g, 宝宝如何养成早睡早起的习惯"
time="2023-02-13T15:51:21Z" level=info msg="问题: , 宝宝如何养成早睡早起的习惯"
time="2023-02-13T15:51:21Z" level=info msg="request openai json string : {"model":"text-davinci-003","prompt":", 宝宝如何养成早睡早起的习惯","max_tokens":4000,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0}"
time="2023-02-13T15:52:02Z" level=info msg="{"id":"cmpl-6jVOsxbTtEvZdqsWNNXIqavVBQCLV","object":"text_completion","created":1676303482,"model":"text-davinci-003","choices":[{"text":"\n\n1. 规定固定的睡眠时间。宝宝每天睡觉的时间要固定,可以按照宝宝的年龄来定(一岁以内的宝宝每天睡11-13个小时,一岁至三岁的宝宝每天睡10-12个小时,三岁以上的宝宝每天睡9-11个小时)。\n\n2. 定时定点预备睡觉。每天晚上定时定点,如果宝宝不喜欢睡觉,可以适当放慢睡觉的时间,比如把晚上的活动时间推迟几分钟,让宝宝有充足的时间准备睡觉。\n\n3. 建立睡觉前的习惯。建立睡觉前的一些习惯,比如给宝宝洗澡,读故事,唱儿歌等,让宝宝有一个舒服的睡眠环境,有助于宝宝早睡早起。\n\n4. 让宝宝在清晨有好的开始。让宝宝在清晨有一个好的开始,可以让宝宝做一些快乐的事情,比如打开窗帘,看阳光,做些活动,开车等。让宝宝体验到清晨的快乐,有助于宝宝早睡早起。","index":0,"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":31,"completion_tokens":671,"total_tokens":702}}\n"
time="2023-02-13T15:52:02Z" level=info msg="gpt response text: \n\n1. 规定固定的睡眠时间。宝宝每天睡觉的时间要固定,可以按照宝宝的年龄来定(一岁以内的宝宝每天睡11-13个小时,一岁至三岁的宝宝每天睡10-12个小时,三岁以上的宝宝每天睡9-11个小时)。\n\n2. 定时定点预备睡觉。每天晚上定时定点,如果宝宝不喜欢睡觉,可以适当放慢睡觉的时间,比如把晚上的活动时间推迟几分钟,让宝宝有充足的时间准备睡觉。\n\n3. 建立睡觉前的习惯。建立睡觉前的一些习惯,比如给宝宝洗澡,读故事,唱儿歌等,让宝宝有一个舒服的睡眠环境,有助于宝宝早睡早起。\n\n4. 让宝宝在清晨有好的开始。让宝宝在清晨有一个好的开始,可以让宝宝做一些快乐的事情,比如打开窗帘,看阳光,做些活动,开车等。让宝宝体验到清晨的快乐,有助于宝宝早睡早起。 \n"
time="2023-02-13T15:52:02Z" level=info msg="Ret(1204)"
time="2023-02-13T15:52:02Z" level=error msg="handle error: Ret(1204)\n"

[need] 添加“回话时间”的参数

请求添加类似如下表述的变量:

session_timeout:会话超时时间,默认60秒,单位秒,在会话时间内所有发送给机器人的信息会作为上下文。

目前bot的时间变量好像是0?

image

使用docker启动,扫码后无法使用

docker run -d
--name wechatgpt
-e api_key="你的chatgpt api_key"
-e wechat="true"
xiaomoinfo/wechatgpt:latest

启动后,网页扫码
日志返回
2023/02/11 16:54:31 扫码成功,请在手机上确认登录

确认后,容器停止没有任何日志,请问怎么解决

无法自动回复

链接上我的wechat后可以抓取关键词并通过API返回结果到后台,但是不能在微信中自动回复给群里

[need] 限定telegram id使用tgbot

感谢大佬单独分离出telegram,很enjoy!!

能否把限定id的参数也提上日程,大概是这样的,不知道对不对(非专业):

if (message.user.id == '<USER_ID>') {
return;
}

PS.用了全github的相关机器人,为啥别的项目都是用无头抓cookie登录,不光麻烦,还老出问题,为啥佬能直接用api,他们都说api用不了,包括star最多的那个项目也这么说,好奇。大佬可以考虑改名?类似telegram-wechat-chatgpt,应该会涨不少star吧。

config.yaml.example配置文件中修改wechat的值

config.yaml.example配置文件中应该修改true,带上双引号;否则读取配置项不能识别。

chatgpt:
  token: your chatgpt apiKey
  wechat: "true"
  wechat_keyword: chatgpt
  #telegram: your telegram token
  #tgWhitelist: username1,username2
  #tgKeyword: chatgpt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.