fanchunke / chatgpt-wecom Goto Github PK
View Code? Open in Web Editor NEW企业微信接入 GPT3
License: MIT License
企业微信接入 GPT3
License: MIT License
自创应用已经成功,但是如何与企业微信中的机器人链接呢,我用机器人的webhook url 替代conf里面的url里面,得到结果就是: 响应失败,错误码:93000,错误原因:invalid webhook url
现在最新的模型可以生成图片,能否加上这个功能呢?
[90m2023-03-04T10:59:52Z�[0m ERROR �[1m../../../app/internal/api/receive.go:43�[0m�[36m >�[0m Get GPT Response error: CreateCompletion failed: Post "https://api.openai.com/v1/completions": dial tcp 168.143.171.93:443: i/o timeout �[36merror=�[0m�[31m"CreateCompletion failed: Post "https://api.openai.com/v1/completions": dial tcp 168.143.171.93:443: i/o timeout"�[0m
2023/03/04 10:59:52 CreateCompletion failed: Post "https://api.openai.com/v1/completions": dial tcp 168.143.171.93:443: i/o timeout
是否可以自己定义openai api的调用URL ,在哪里修改,谢谢
我用windows的跑,闪崩;我用linux20.04的跑,提示文件busy。很明显编译都有问题。可能是缺文件,并且linux的格式一般后缀都是debian啊
刚发布了, 想尝鲜,不知道是否有接口了,请大佬关注和更新。 /膜拜
2023-03-10T07:25:49Z INFO ../../../app/internal/api/receive.go:116 > [AgentId: 1000019] [UserId: SHEN] Start Send Wecom Response: 欢迎来到 ChatGPT,在这里您可以和我对话,我将尽我所能回答您的问题。如果想关闭会话,请回复“/restart”。
2023-03-10T07:25:49Z DEBUG ../../../app/pkg/wecom/wecom.go:58 > [Request] URL: /cgi-bin/gettoken, Method: GET, Query: map[corpid:[XXXXX] corpsecret:[XXXXXX]], Form: map[], Body: <nil>, Headers: map[]
2023/03/10 07:25:54.269922 ERROR RESTY Get "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=XXXX&corpsecret=XXXXX": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1
在Get token 时候报错, 同样的参数在浏览器用get 可以看到正确的access token.
{"errcode":0,"errmsg":"ok","access_token":"-fuxLajhLWGmioaIxfWnpg3FpM552-hAsV4QU4kmwKCAbcGFsV3WVWCYAng","expires_in":7200}
/home/works/program # ./app -conf=conf/online.conf -init-ent
2023/02/16 09:00:51 maxprocs: Leaving GOMAXPROCS=2: CPU quota undefined
`
{"level":"debug","time":"2023-03-07T11:07:46Z","caller":"/go/pkg/mod/github.com/fanchunke/[email protected]/client.go:219","message":"User: cxkj_xxx, Messages with conversation: [{"role":"user","content":\ "测试"}]"}
{"level":"error","error":"CreateCompletion failed: Post "https://api.openai.com/v1/chat/completions\": dial tcp: lookup api.openai.com: device or resource busy","time":"2023-03-07T11:07:46Z","caller":"/app /internal/api/receive.go:59","message":"Get GPT Response error: CreateCompletion failed: Post "https://api.openai.com/v1/chat/completions\": dial tcp: lookup api.openai.com: device or resource busy"}
`
请问各位大佬,这问题怎么解决?
有木有小白教程
如何有一个详细的安装教程,是很多愿意尝试的小白得以下手和传播。如果有视频教程就更优秀了,非常感谢您辛勤的付出,和奉献。
2023-02-20T15:29:44Z ERROR ../../../app/internal/api/receive.go:43 > Get GPT Response error: CreateCompletion failed: Post "https://api.openai.com/v1/completions": dial tcp: lookup api.openai.com: device or resource busy error="CreateCompletion failed: Post \"https://api.openai.com/v1/completions\": dial tcp: lookup api.openai.com: device or resource busy"
数据库文件名设置为了什么?我在那里可以找到
日志文件有大小上限吗?debug级别的输出会比较多,日志文件如果没有rotation, 久了会撑爆的。最好可以配置日志上限,或者硬编码比如10MB也行啊。 如果有了,请忽略。
企业微信url回调总是不通过,有这方面配置的代码或者相关资料么?
服务器用的是国外的vps,配置可信ip成功,但用企业微信发送消息无回复
之后可以支持微信群么?现在只能是单独的聊天
root@ser720184626473:~/chatgpt-wecom# docker-compose up -d Creating chatgpt-wecom ... done root@ser720184626473:~/chatgpt-wecom# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 040e27c08832 chatgpt-wecom_chatgpt-wecom "./app" 8 seconds ago Restarting (1) Less than a second ago chatgpt-wecom 7fdfc045d1a9 teampgm/pagermaid_pyro "sh utils/docker-con…" 4 weeks ago Up 3 hours PagerMaid root@ser720184626473:~/chatgpt-wecom# docker exec -it 040e27c08832 bash Error response from daemon: Container 040e27c08832f21d1dde3acb65e0ffd0c5942dc33bec03ffcb415c5d2e98fdf5 is restarting, wait until the container is running root@ser720184626473:~/chatgpt-wecom#
发现机器人很慢,直接连接openai的话很快1-2秒,但是使用这个机器人发现返回时间特别长,不知道是否哪里可以优化的空间,当然还是特别感谢项目方。
�[90m2023-02-26T08:34:16Z�[0m ERROR �[1mroot/workspace/chatqpt-wecom_BqLG/internal/api/receive.go:43�[0m�[36m >�[0m Get GPT Response error: CreateCompletion failed: Post "https://api.openai.com/v1/completions": x509: certificate signed by unknown authority �[36merror=�[0m�[31m"CreateCompletion failed: Post "https://api.openai.com/v1/completions": x509: certificate signed by unknown authority"�[0m
2023/02/26 08:34:16 CreateCompletion failed: Post "https://api.openai.com/v1/completions": x509: certificate signed by unknown authority
x509: certificate signed by unknown authority
这个跟部署环境有关系吗,我是部署在上海的
引用:#10
[GIN] 2023/03/09 - 08:45:10 | 404 | 555.801µs | 54.249.18.254 | POST "/wecom/receive/v2/cgi-bin/message/send?access_token="
2023-03-09T08:45:10Z DEBUG ../../Users/fanchunke/workspace/chatgpt/chatgpt-wecom/pkg/wecom/wecom.go:69 > [Response] Status: 404, Body: 404 page not found, Headers; map[Connection:[keep-alive] Content-Length:[18] Content-Type:[text/plain] Date:[Thu, 09 Mar 2023 08:45:10 GMT] Server:[nginx/1.18.0] X-Request-Id:[cg4pp5hlg1eth8fn8qig]]
2023/03/09 08:45:10.682357 ERROR RESTY 请求失败, Attempt 1
2023-03-09T08:45:10Z ERROR ../../Users/fanchunke/workspace/chatgpt/chatgpt-wecom/pkg/wecom/wecom.go:92 > 请求失败 error="请求失败"
2023-03-09T08:45:10Z ERROR ../../Users/fanchunke/workspace/chatgpt/chatgpt-wecom/internal/api/receive.go:83 > Send Wecom Response error: Send Wecom Message failed: 请求失败 error="Send Wecom Message failed: 请求失败"
2023/03/09 08:45:10 Send Wecom Message failed: 请求失败
windows系统,非docker环境运行,错误日志如下:
{"level":"fatal","error":"sqlite: check foreign_keys pragma: reading schema information Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub","time":"2023-03-03T14:22:01+08:00","caller":"/Users/fanchunke/workspace/chatgpt/chatgpt-wecom/internal/app/app.go:35","message":"ent - database migrate failed"}
�[90m2023-03-04T15:58:56Z�[0m ERROR �[1m../../../app/internal/api/receive.go:43�[0m�[36m >�[: Post "https://api.openai.com/v1/completions": read tcp 172.17.0.2:54742->52.152.96.252:443: read: connection reset by peer �[36merror=�[0m�[31m"CreateCompletion failed: Post "https://api.openai.com/v1/completions": read tcp 172.17.0.2:54742->52.152.96.252:443: read: connection reset by peer"�[0m
2023/03/04 15:58:56 CreateCompletion failed: Post "https://api.openai.com/v1/completions": read tcp 172.17.0.2:54742->52.152.96.252:443: read: connection reset by peer
数据库有存消息但企业微信没回复log日志提示
{"level":"error","url":"/wecom/receive?msg_signature=c32c3123cb23a9caf106d83145315438eb435d49×tamp=1676529022&nonce=1676457839","method":"POST","requestId":"cfmsqvj52fjj6fpq1gb0","error":"UnSupported MsgType: event","time":"2023-02-16T06:30:22Z","caller":"/app/internal/api/receive.go:31","message":"Convert wecom msg error: UnSupported MsgType: event"}
如果请求过多,OpenAI可能会封IP
CreateCompletion failed: error, status code: 500, message: The server had an error while processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if the error persists.
建议增加预设Prompt的功能
RT,如果能使用腾讯云函数作为中转,实现企业微信应用调用chatGPT,那就爽了
因为之前腾讯云域名备案,一定要有个服务器ip,就买了云函数备案包,3年有效期……平时没啥用,docker 的话,还得搞个云主机吧
希望能够一小时内进入不再提示
效果跟Davinci模型一样,价格是原来的十分之一。
如题
数据库内已看到对话记录,但企业微信内没有返回消息。
2023-02-16T08:06:02Z FATAL ../../../app/cmd/app/app.go:36 > failed creating schema resources error="mysql: querying mysql version dial tcp 127.0.0.1:3306: connect: connection refused"
您好,请问在做到
构建镜像
make dockerenv
这一步时,出现这个提示。请问我该怎么处理?谢谢。
Step 11/17 : RUN go build -ldflags '-linkmode external -extldflags "-static"' -o /bin/chatgpt-wecom ./cmd/app
---> Running in a46fc6720189
# github.com/fanchunke/chatgpt-wecom/cmd/app
/usr/bin/ld: /tmp/go-link-541147318/000010.o: in function `unixDlOpen':
/go/pkg/mod/github.com/mattn/[email protected]/sqlite3-binding.c:42050: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-541147318/000016.o: in function `_cgo_2ac87069779a_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Removing intermediate container a46fc6720189
root@VM-4-5-debian:~/chatgpt-wecom# docker exec -it chatgpt-wecom sh
/home/works/program # ./app -conf=conf/online.conf -init-ent
2023/02/18 05:25:01 maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined
/home/works/program #
企业微信配置都没问题
如我的问题一直没找到问题所在!!!
/usr/bin/ld: /tmp/go-link-3718870333/000010.o: in function unixDlOpen': /go/pkg/mod/github.com/mattn/[email protected]/sqlite3-binding.c:42050: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: /tmp/go-link-3718870333/000016.o: in function
_cgo_6cc2654a8ed3_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
我知道用户输入/restart可以重置对话,但如果用户不知道或忽略了这操作。会话会持续增加,token消耗,回复准确度也会有影响。我没看到有哪里可以配置会话上限的配置。如果有(比如最多对话10次)请告知一下;如果没有,我想不要脸的请求添加此配置。
我对应用账号发消息,能收到,但是不回复。openai接口正确,数据库也能看到消息。
最近接入微信封号了好多,接入企业微信不知道咋样
如分钟内使用人数10左右,每人两到三条消息似乎部分用户无法接受到反馈
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.