利用Github Copilot实现GPT交互

本文最后更新于 127 天前, 如有失效请评论区留言.
You are viewing version v2 of this article, which has older versions: v1.

本文主要记录一下如何部署将Github Copilot转换为ChatGPT

要求

github账号已经开通Github Copilot,具体可点击链接确定
其成本相对于来说还是比较高的,长期可用性还得打个问号。但是如果你已经买了,可以考虑使用这种方式, 无限制免费使用 GPT-4 模型。

风险

目前来看不知道是否违背Copilot TOS, 存在一定风险,使用需谨慎,请勿公开分享。

原理

细节可以参考后端服务copilot-gpt4-service

部署

直接上手部署一键到位, 到这里API基本就可以用了。

version: '3'

services:
  copilot:
    image:  aaamoon/copilot-gpt4-service
    container_name: copilot
    ports:
      - 8080:8080
    restart: always
  chatgpt-next-web:
    image: yidadaa/chatgpt-next-web
    container_name: chatgpt-next-web
    ports:
      - 3000:3000
    restart: always

直接docker compose启动

docker compose up -d

Token获取

另外可以通过安装Jetbrains github-copilot 插件 可以直接获取

23:41 ➜  ~ cat ~/.config/github-copilot/hosts.json
{"github.com":{"user":"ysicing","oauth_token":"ghu_打码"}}

配置

我试过通过环境变量方式,貌似不生效,手动设置一下

  1. 勾选自定义接口

  1. 配置地址和Token

地址没有/api/openai路径
Token由ghu_打头

  1. 测试, 判断鲁迅和周树人关系

其他

既然这样能用,是不是CodeGPT也可以支持😂

本周抽空会逐一测试一下,博客评论已经用上了,默认会经过GPT审核一次😂

感谢

Sponsor

Like this article? $1 reward

Comments

林木木 ·v2 浙江宁波 Reply

哈,热力图,折腾愉快~

奶爸博客 ·v2 瑞典 Reply

有点意思……我也有 Github Copilot,不敢滥用怕封

ysicing 👨‍💻 ·v2 Reply

@奶爸博客 个人使用应该不会吧,风险肯定是有的。但是Copilot平时用的也不是特别多,吃灰散发余热吧😄

According to the relevant laws and regulations of the People's Republic of China, the comment function of the current website has been disabled. If you need to comment, please visit ysicing.me, but the comments still need to be reviewed by AI.