请更新你的Copilot后端代理,本地部署不再需要修改host

TL;DR: VS Code v1.96更新后增强了对https的要求,更新Copilot后端到v0.1.0以上版本可适配,且本地使用不再需要修改host,局域网共享仅需额外设置host即可。

前情提要

前几天发了一个Override替代品——Copilot后端代理的教程
Override无缝替代 —— Copilot 后端,适配最新版copilot chat - 开发调优 - LINUX DO

但是VS Code 更新到v1.96.0以后,增强了对https的要求,使得copilot chat报错,作者紧急更新的仓库,修复了这个问题。下面给出新版教程。

Docker 部署,本机自用

1.配置服务

下载 docker-compose.yml 文件下载到本地, 将里面的 API KEY 替换。

注意需更新docker-compose.yml 文件中的域名配置为:

- DEFAULT_BASE_URL=https://copilot.supercopilot.top
- API_BASE_URL=https://api.copilot.supercopilot.top
- PROXY_BASE_URL=https://copilot-proxy.copilot.supercopilot.top
- TELEMETRY_BASE_URL=https://copilot-telemetry-service.copilot.supercopilot.top

Docker 启动!

# 启动服务
docker compose up -d

# 查看日志
docker logs copilot-app

# 停止服务
docker compose down

注意事项

  • 如使用了代理工具,请将 *.copilot.supercopilot.top 域名添加直连;
  • 无需修改本机host文件(*.copilot.supercopilot.top 的 DNS解析其ip是127.0.0.1);

2.VSCode 设置

setting.json文件内容:

"github.copilot.advanced": {
  "authProvider": "github-enterprise",
  "debug.overrideCAPIUrl": "https://api.copilot.supercopilot.top",
  "debug.overrideProxyUrl": "https://copilot-proxy.copilot.supercopilot.top",
  "debug.chatOverrideProxyUrl": "https://api.copilot.supercopilot.top/chat/completions",
  "debug.overrideFastRewriteEngine": "v1/engines/copilot-centralus-h100",
  "debug.overrideFastRewriteUrl": "https://api.copilot.supercopilot.top"
},
"github-enterprise.uri": "https://copilot.supercopilot.top"

登录步骤参照 Override无缝替代 —— Copilot 后端,适配最新版copilot chat - 开发调优 - LINUX DO

Docker部署,局域网共享

除了上述步骤外,仅需额外设置局域网host。
例如:
在局域网服务器(192.168.80.40)部署了copilot-proxies服务,那么局域网内其他机器仅需要修改host为以下即可,可以工作

192.168.80.40 copilot.supercopilot.top
192.168.80.40 api.copilot.supercopilot.top
192.168.80.40 copilot-proxy.copilot.supercopilot.top
192.168.80.40 copilot-telemetry-service.copilot.supercopilot.top
32 个赞

前排围观支持一下

4 个赞

火速前来支持

4 个赞

我就说怎么感觉变笨了 懒人版还能用吗

1 个赞

太强了大佬

2 个赞

必须支持一下

1 个赞

超级懒人版提供的公共接口 https://api.mycopilot.noteo.cn 是调用硅基流动的免费模型,性能可能弱一些。
此外,该接口有限速,仅做测试用,不建议日常使用。

大佬, 什么个情况

m":null,“code”:“invalid_request_error”}}
[GIN] 2024/12/13 - 13:21:14 | 401 | 172.44798ms | 172.18.0.1 | POST “/chat/completions”
[GIN] 2024/12/13 - 13:21:14 | 200 | 125.297µs | 172.18.0.1 | GET “/copilot_internal/v2/token”
[GIN] 2024/12/13 - 13:21:14 | 200 | 98.254µs | 172.18.0.1 | GET “/user”
[GIN] 2024/12/13 - 13:21:14 | 200 | 76.808µs | 172.18.0.1 | GET “/teams/1682102/memberships/github”
[Copilot Proxies] 2024/12/13 13:21:22 server.go:3219: http: TLS handshake error from 172.18.0.1:40482: remote error: tls: unknown certificate
[Copilot Proxies] 2024/12/13 13:21:22 server.go:3219: http: TLS handshake error from 172.18.0.1:40494: remote error: tls: unknown certificate
[Copilot Proxies] 2024/12/13 13:21:23 server.go:3219: http: TLS handshake error from 172.18.0.1:40500: remote error: tls: unknown certificate
[Copilot Proxies] 2024/12/13 13:21:23 server.go:3219: http: TLS handshake error from 172.18.0.1:40514: remote error: tls: unknown certificate

1 个赞

前排围观支持一下

留门,留门

登录失败:
无法访问此网站 **copilot.supercopilot.top** 意外终止了连接。
代理设置了DOMAIN-SUFFIX,copilot.supercopilot.top,:dart: 全球直连

我是提示证书错误

request completions failed: {“code”:20014,“message”:“Message field is required.”,“data”:null}
使用chat报这个错,生成是没问题的

chat 接口地址不对, 应该是 v1/chat/com…

大佬们都是在本地部署使用的吗,我在服务器起了这个docker服务,然后本地hosts修改域名指向了服务器ip,登录的时候直接拒绝访问了 :joy:

如果是局域网多台电脑共用一个服务端,只需要更改hosts文件指向到内网服务器 ip 即可, 例如:
在局域网服务器(192.168.80.40)部署了copilot-proxies服务,那么局域网内其他机器仅需要修改host为以下即可

192.168.80.40 copilot.supercopilot.top
192.168.80.40 api.copilot.supercopilot.top
192.168.80.40 copilot-proxy.copilot.supercopilot.top
192.168.80.40 copilot-telemetry-service.copilot.supercopilot.top

我是这么做的,但是报错:
Sign in failed. Reason: Request signInInitiate failed with message: EditorFetcher request failed: Error processing request: Remote host terminated the handshake: undefined, request id: 15, error code: -32603

hosts配置:
113.xx.xx.xx copilot.supercopilot.top

113.xx.xx.xx api.copilot.supercopilot.top

113.xx.xx.xx copilot-proxy.copilot.supercopilot.top

113.xx.xx.xx copilot-telemetry-service.copilot.supercopilot.top

113 的 ip 应该不是局域网服务器吧? 看项目中的自有服务器部署内容

感谢佬的分享

请教佬友一个问题
我看copilot.supercopilot.top域名是解析到127.0.0.1
那么自有服务部署的时候是如何转发到服务器的呢
我看有nginx配置 但是那不是配在服务器上的吗

1 个赞