wechatbot
wechatbot copied to clipboard
支持http代理地址
你好,我想问问在那些地方添加api的http代理地址,我怎么调都是报错
只要你网络能直接调通openai接口,这代理没啥用,直接那那行代码去掉就行或者自己写个重载函数也行
我打算部署到国内😅
各位代理可以按照以下修改:gpt.go 66行左右! apiKey := config.LoadConfig().ApiKey req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+apiKey) proxyURL, _ := url.Parse("http://127.0.0.1:7890") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), }, } response, err := client.Do(req)
2023/10/28 19:29:00 扫码成功,请在手机上确认登录 2023/10/28 19:29:11 登录成功 2023/10/28 19:29:12 RetCode:0 Selector:2 2023/10/28 19:29:12 hadler Received msg : 2023/10/28 19:29:12 hadler Received msg : 2023/10/28 19:29:12 RetCode:0 Selector:2 2023/10/28 19:29:12 hadler Received msg : 2023/10/28 19:29:13 RetCode:0 Selector:2 2023/10/28 19:29:13 hadler Received msg : 2023/10/28 19:29:16 RetCode:0 Selector:2 2023/10/28 19:29:17 RetCode:0 Selector:2 2023/10/28 19:29:17 hadler Received msg : 2023/10/28 19:29:31 RetCode:0 Selector:2 2023/10/28 19:29:31 hadler Received msg : 2023/10/28 19:29:49 RetCode:0 Selector:2 2023/10/28 19:29:50 hadler Received msg : 你好 2023/10/28 19:29:52 Received User Meeee Text Msg : 你好 panic: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 127.0.0.1:7890: connectex: No connection could be made because the target machine actively refused it.
goroutine 42 [running]: github.com/poorjobless/wechatbot/chatgpt.Completions({0xc0000ea9c6, 0x9}, {0xc000095340, 0x6}) D:/10-28/wechatbot-main/chatgpt/chatgpt.go:31 +0x325 github.com/poorjobless/wechatbot/handlers.(*UserMessageHandler).ReplyText(0xc0000e9db0?, 0xc000272780) D:/10-28/wechatbot-main/handlers/user_msg_handler.go:46 +0x1bd github.com/poorjobless/wechatbot/handlers.(*UserMessageHandler).handle(0x3aeea0?, 0xc00001d440?) D:/10-28/wechatbot-main/handlers/user_msg_handler.go:21 +0x25 github.com/poorjobless/wechatbot/handlers.Handler(0xc000272780) D:/10-28/wechatbot-main/handlers/handler.go:54 +0x282 github.com/eatmoreapple/openwechat.(*Bot).syncCheck(0xc0001181c0) C:/Users/linweiliang02/go/pkg/mod/github.com/eatmoreapple/[email protected]/bot.go:269 +0x227 github.com/eatmoreapple/openwechat.(*Bot).WebInit.func1() C:/Users/linweiliang02/go/pkg/mod/github.com/eatmoreapple/[email protected]/bot.go:190 +0x79 created by github.com/eatmoreapple/openwechat.(*Bot).WebInit in goroutine 1 C:/Users/linweiliang02/go/pkg/mod/github.com/eatmoreapple/[email protected]/bot.go:185 +0x276 exit status 2
你好,这个是什么意思呢
2023/10/28 19:35:43 Received User Meeee Text Msg : 哈哈 2023/10/28 19:35:43 request gtp json string : {"model":"text-davinci-003","prompt":"哈哈","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:35:43 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9455->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:35:44 RetCode:0 Selector:2 2023/10/28 19:36:09 RetCode:0 Selector:0 2023/10/28 19:36:10 RetCode:0 Selector:2 2023/10/28 19:36:10 hadler Received msg : 你说什么 2023/10/28 19:36:10 Received User Meeee Text Msg : 你说什么 2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2
你好,这个接口目前不可以使用吗
我打算部署到国内😅
我想问问目前解决了吗 我遇到了这个问题 request gtp json string : {"model":"text-davinci-003","prompt":"哈喽","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 21:33:03 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:41925->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host.
你可以在腾讯云,选择一个节点在国外的云函数,做个代理
诚南花已开 @.***
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上9:41 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8)
我打算部署到国内😅
我想问问目前解决了吗 我遇到了这个问题 request gtp json string : {"model":"text-davinci-003","prompt":"哈喽","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 21:33:03 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:41925->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
proxyURL, _ := url.Parse("http://127.0.0.1:7890") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },
proxyURL, _ := url.Parse("http://127.0.0.1:7890/") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },其实就是多了这些对吧 但是会报错呢
2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2
目前是报这个错误 是代理的问题吗 2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2
可以用的,需要科学上网,才能访问到openai
诚南花已开 @.***
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上7:37 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8)
2023/10/28 19:35:43 Received User Meeee Text Msg : 哈哈 2023/10/28 19:35:43 request gtp json string : {"model":"text-davinci-003","prompt":"哈哈","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:35:43 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9455->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:35:44 RetCode:0 Selector:2 2023/10/28 19:36:09 RetCode:0 Selector:0 2023/10/28 19:36:10 RetCode:0 Selector:2 2023/10/28 19:36:10 hadler Received msg : 你说什么 2023/10/28 19:36:10 Received User Meeee Text Msg : 你说什么 2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2
你好,这个接口目前不可以使用吗
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
可以用的,需要科学上网,才能访问到openai 诚南花已开 @.*** … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上7:37 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8) 2023/10/28 19:35:43 Received User Meeee Text Msg : 哈哈 2023/10/28 19:35:43 request gtp json string : {"model":"text-davinci-003","prompt":"哈哈","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:35:43 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9455->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:35:44 RetCode:0 Selector:2 2023/10/28 19:36:09 RetCode:0 Selector:0 2023/10/28 19:36:10 RetCode:0 Selector:2 2023/10/28 19:36:10 hadler Received msg : 你说什么 2023/10/28 19:36:10 Received User Meeee Text Msg : 你说什么 2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2 你好,这个接口目前不可以使用吗 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
我的网页时可以访问openai的呢
用postman 调一下openai的接口,能通,则是你的服务调用有些问题。部署在腾讯云上,一般响应时间比较长
诚南花已开 @.***
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上9:53 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8)
可以用的,需要科学上网,才能访问到openai 诚南花已开 @.*** … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上7:37 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8) 2023/10/28 19:35:43 Received User Meeee Text Msg : 哈哈 2023/10/28 19:35:43 request gtp json string : {"model":"text-davinci-003","prompt":"哈哈","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:35:43 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9455->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:35:44 RetCode:0 Selector:2 2023/10/28 19:36:09 RetCode:0 Selector:0 2023/10/28 19:36:10 RetCode:0 Selector:2 2023/10/28 19:36:10 hadler Received msg : 你说什么 2023/10/28 19:36:10 Received User Meeee Text Msg : 你说什么 2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2 你好,这个接口目前不可以使用吗 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
我的网页时可以访问openai的呢
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
诚南花已开 @.***
------------------ 原始邮件 ------------------ 发件人: "djun/wechatbot" @.>; 发送时间: 2023年10月28日(星期六) 晚上9:49 @.>; @.@.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8)
proxyURL, _ := url.Parse("http://127.0.0.1:7890") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },
proxyURL, _ := url.Parse("http://127.0.0.1:7890/") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },其实就是多了这些对吧 但是会报错呢
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
诚南花已开 @.***
------------------ 原始邮件 ------------------ 发件人: "djun/wechatbot" @.>; 发送时间: 2023年10月28日(星期六) 晚上9:49 @.>; @.@.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8)
proxyURL, _ := url.Parse("http://127.0.0.1:7890") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },
proxyURL, _ := url.Parse("http://127.0.0.1:7890/") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },其实就是多了这些对吧 但是会报错呢
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
使用postman调一下openai的接口,能通,你的服务调用一些问题。在腾讯云上部署,一般响应时间比较长 诚南花已开 @.*** …… ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上9:53 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8) 可以用的,需要科学上网,才能访问到openai 诚南花已开 @.*** … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年10月28日(星期六) 晚上7:37 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8) 2023/10/28 19:35:43 Received User Meeee Text Msg : 哈哈 2023/10/28 19:35:43 request gtp json string : {"model":"text-davinci-003","prompt":"哈哈","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:35:43 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9455->104.18.7.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:35:44 RetCode:0 Selector:2 2023/10/28 19:36:09 RetCode:0 Selector:0 2023/10/28 19:36:10 RetCode:0 Selector:2 2023/10/28 19:36:10 hadler Received msg : 你说什么 2023/10/28 19:36:10 Received User Meeee Text Msg : 你说什么 2023/10/28 19:36:10 request gtp json string : {"model":"text-davinci-003","prompt":"你说什么","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 19:36:11 gtp request error: Post "https://api.openai.com/v1/completions": read tcp 192.168.10.17:9508->104.18.6.192:443: wsarecv: An existing connection was forcibly closed by the remote host. 2023/10/28 19:36:11 RetCode:0 Selector:2 你好,这个接口目前不可以使用吗 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 我的网页时可以访问openai的呢 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>
好的 谢谢 2023/10/28 22:01:42 request gtp json string : {"model":"text-davinci-003","prompt":"哈哈","max_tokens":2048,"temperature":0.7,"top_p":1,"frequency_penalty":0,"presence_penalty":0} 2023/10/28 22:01:42 gtp request error: Post "https://api.openai.com/v1/completions": proxyconnect tcp: dial tcp 127.0.0.1:7890: connectex: No connection could be made because the target machine actively refused it.
诚南花已开 @.*** … ------------------ 原始邮件 ------------------ 发件人: "djun/wechatbot" @.>; 发送时间: 2023年10月28日(星期六) 晚上9:49 @.>; @.@.>; 主题: Re: [djun/wechatbot] 支持http代理地址 (PR #8) proxyURL, _ := url.Parse("http://127.0.0.1:7890") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), }, proxyURL, _ := url.Parse("http://127.0.0.1:7890/") client := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyURL(proxyURL), },其实就是多了这些对吧 但是会报错呢 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
您好,方便留个联系方式吗?我这里还是遇到了一些问题