aaamoon / copilot-gpt4-service Goto Github PK
View Code? Open in Web Editor NEWConvert Github Copilot to ChatGPT
License: MIT License
Convert Github Copilot to ChatGPT
License: MIT License
Other wise some translators can't work properly.
`
$ docker logs e279b6349f44
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
[GIN-debug] POST /v1/chat/completions --> main.chatCompletions (4 handlers)
[GIN-debug] GET /v1/models --> main.createMockModelsResponse (4 handlers)
[GIN-debug] GET /healthz --> main.main.func1 (4 handlers)
[GIN-debug] Listening and serving HTTP on :8080
[GIN] 2024/01/06 - 15:01:06 | 200 | 9.209µs | 192.168.65.1 | OPTIONS "/v1/chat/completions"
2024/01/06 15:01:06 [Recovery] 2024/01/06 - 15:01:06 panic recovered:
POST /v1/chat/completions HTTP/1.1
Host: 127.0.0.1:8080
[GIN] 2024/01/06 - 15:01:06 | 500 | 274.797667ms | 192.168.65.1 | POST "/v1/chat/completions"
Accept: text/event-stream
Accept-Encoding: gzip, deflate, br
Accept-Language: en-HK,en;q=0.9,zh-HK;q=0.8,zh;q=0.7,en-US;q=0.6,en-GB;q=0.5,zh-TW;q=0.4
Authorization: *
Connection: keep-alive
Content-Length: 404
Content-Type: application/json
Origin: https://gpt4copilot.tech
Sec-Ch-Ua: "Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "macOS"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
X-Requested-With: XMLHttpRequest
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:261 (0x5c53b)
/usr/local/go/src/runtime/signal_unix.go:861 (0x5c508)
/app/utils/utils.go:49 (0x30271c)
/app/utils/utils.go:83 (0x3029c7)
/app/main.go:158 (0x303dbf)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165 (0x2f876b)
/app/main.go:30 (0x304b7b)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165 (0x2fd38f)
/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:99 (0x2fd374)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165 (0x2fc76f)
/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:241 (0x2fc738)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165 (0x2fb917)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:489 (0x2fb648)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:445 (0x2fb393)
/usr/local/go/src/net/http/server.go:2938 (0x227e2b)
/usr/local/go/src/net/http/server.go:2009 (0x2251d7)
/usr/local/go/src/runtime/asm_arm64.s:1197 (0x782a3)
`
是不是首先得自己是copilot付费用户? 看readme 看不懂。
Failed to get Copilot token from GitHub
Install github-copilot-cli:
# https://www.npmjs.com/package/@githubnext/github-copilot-cli
npm i @githubnext/github-copilot-cli -g
Retrieve the token:
github-copilot-cli auth
View the token:
vim ~/.copilot-cli-access-token
4de3bce 中试图添加流式传输缺失字段,但是他检测
他是通过检测当前的缓冲区里面是否有特定字段比如choice
等,判断是不是应该加入缺失的字段
但是由于字段可能被截断 (比如choi
在上一个缓冲区里,ce
在下一个缓冲区里),这样就会出问题
所以其实流式传输的部分应该再改一次,应该读取一个stream event,处理后发给客户端,而不是用固定大小的缓冲区读取固定大小
部署这个service需要找翻qiang的服务器不
这个会不会损耗copilot的tokens?还是copilot的api接口是免费的?无论gpt3.5还是gpt4?
为什么 这里 要等0.1s
是让buffer读取更多内容吗,感觉对于3.5这种本身相应就很快的模型的流畅度略有影响
在 ChatBox 和 ChatX 上都成功了(OpenCat 不支持 http 协议就没尝试)
但是 ChatGPT-Next-Web 上一直失败,不论是自己部署在 Vercel 的实例还是官方的 demo,都报 failed to fetch
你好,我尝试在本地安装NextChat并使用Docker部署了copilot-gpt4-service,接口地址填http://127.0.0.1:8080时可以正常使用。
然后我尝试在局域网另一台服务器使用podman部署了copilot-gpt4-service,在本机使用NextChat,接口地址填http://服务器地址:8080 则报错
{
"error": true,
"message": "Failed to fetch"
}
该服务器的防火墙已经允许8080的入站访问,浏览器访问http://服务器地址:8080 可以出现404 page not found页面。
此外,在本地安装的NextChat中接口地址填入http://gpt4copilot.tech/ 也报同样的错误。
想问一下这个问题该怎么解决呢?谢谢!
大佬有试过在vercel部署这个service代理吗
现在已经可以进行正常对话,但最近好像每条消息之前都会有"强烈建议自行部署 copilot-gpt4-service 服务端,否则大量用户的Token会被Github检测到来自同一IP,有可能会对Github账号造成影响,本接口服务将会逐渐下线。
It is strongly recommended to deploy the copilot-gpt4-service server by yourself, otherwise a large number of users' tokens will be detected by Github from the same IP, which may affect the Github account, and the API service will be gradually offline.
强烈建议自行部署 copilot-gpt4-service 服务器,否则 Github 会检测到来自同一 IP 的大量用户令牌,从而影响 Github 账户,API 服务也会逐渐离线。"的提醒.是我自己的问题还是什么问题
当我重新试图申请那个API key的时候
Get device code failed
Please make sure you entered the information correctly.
我无法再进入那个页面了
Are there certain things to report that are not a bug or feature?
Please tell us as exactly as possible about your request, thanks.
We will reply as soon as possible.
但是不能画画吗,用的gpt-4
乘客只能拿到ccu_类型的token
服务部署后,访问服务地址报405 method not allowed,无法访问服务。
服务器可以ping通github api地址
还是说服务器需要能够直连github copilot或者openai才行?
好像只能在大佬的 http://gpt4copilot.tech 内部使用,但是我看您仓库里面也只改了一些配置文件,没研究明白
比如https://cocopilot.org 如何让它失效?
{"code":403,"error":"{"error_details":{"url":"https://github.com/github-copilot/signup?editor={EDITOR}\",\"message\":\"No access to GitHub Copilot found. You are currently logged in as guochenchn.","title":"Signup for GitHub Copilot","notification_id":"no_copilot_access"},"message":"Resource not accessible by integration"}"}data: {"choices":[{"index":0,"delta":{"content":null,"role":"assistant"}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"你","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"好","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"!","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"有","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"什","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"么","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"我","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"可以","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"帮","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"助","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"你","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"的","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"吗","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"index":0,"delta":{"content":"?","role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: {"choices":[{"finish_reason":"stop","index":0,"delta":{"content":null,"role":null}}],"created":1704445604,"id":"chatcmpl-8daS4chlUvIAfZ4CPQxzgBQaeFyF7"}
data: [DONE]
hi @aaamoon
I am a very newbie.
Do you have any easier docs that shows step-by-steps an amature can understand and follow to deploy the service
Thank you so much
使用sqlite实现持久化缓存
在目前的实现中,缓存仅存在于一个map中,重启程序缓存就没了
对于本机部署,重启是经常的事,这样会加大请求github api的次数。所以持久化缓存比较适合本地使用
已经初步实现了Cache结构体,同时支持存储在map里和sqlite里,下一步尝试实现配置文件解析,添加是否启用持久化缓存的配置
希望作者可以解决默认token数的问题和传入图片url的json相关问题
这是gpt-4v的api请求范式
curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-4-vision-preview", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What’s in this image?" }, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" } } ] } ], "max_tokens": 300 }'
在设置的接口地址填入本仓库项目部署出来的 API 地址 https://gpt4copilot.tech
你好,感谢你的限度,我想请问如果使用这个接口传入我的 token ,会不会导致 github 检测到从 https://gpt4copilot.tech 发出太多不同 token 导致有风险存在,例如封号?
我注意到 ChatGPT-Next-Web 在使用 Docker 部署时,可以配置代理,即 -e PROXY_URL=http://localhost:7890
,想问下本项目会支持吗
使用 Cloudflare Worker 部署服务端,但无法使用。在 ChatGPT-Next-Web 和沉浸式翻译配置都提示 500: Missing or malformed Authorization header
。直接访问 Cloudflare Worker 的 Endpoint 显示如下:
{"object":"list","data":[{"id":"gpt-4","object":"model","created":1687882411,"owned_by":"openai"},{"id":"gpt-3.5-turbo","object":"model","created":1677610602,"owned_by":"openai"}]}
同一个 GitHub Copilot token 可以在 https://gpt4copilot.tech 中正常使用。
大佬,你好,我用docker部署在了阿里云上,但是访问报错。不知道怎么回事,求助。
我通过docker在本地部署了aaamoon/copilot-gpt4-service:latest,在NextWeb客户端中填写地址为http://127.0.0.1:8080
,在对NextWeb发送信息时迟迟没有回复,看docker的log发现docker成功接收了请求,但是紧接着报出错误Encountering an error when sending the request.
。如果换填https://gpt4copilot.tech/
就可以正常使用。上级路由通过透明代理做了全局代理,可以直接访问copilot、ChatGPT之类的服务,应该不是被墙了连接不了,想问下可能会是什么原因?
请问如何查看生成token的有效期。
感谢~
RT.
目前使用场景是集成了 沉浸式翻译 chrome插件.
触发了 copilot api 的速率限制. 是否可以针对当前进行速率的基准测试, 然后服务提供速率限制的功能?
条件是基于请求的 content? 预估 TOKEN 的消耗? 或者基于异常响应? 当然这有可能是一个伪需求.
Lines 97 to 109 in ebeb9ee
之前有位大佬写了一个copilot破解的小脚本,也是通过修改token实现的,后来他的账号被封禁、仓库被删。希望本仓库作者小心为妙
部署到自己服务器上 大概一天请求 700次 这样 。会面临 需要更换token的问题吗。
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.