zengbo / cf-copilot-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cf-copilot-service

这是一个将兼容OpenAI API的会话请求转发到Github Copilot Chat API的Cloudflare Worker脚本,模型参数仅支持gpt-4gpt-3.5-turbo,实测使用其他模型均会以默认的3.5处理(对比OpenAI API的返回结果,猜测应该是最早的版本gpt-4-0314gpt-3.5-turbo-0301

使用方法

  1. 你需要拥有一个有Github Copilot权限的Github账户

  2. 使用cocopilot获取token

  3. 创建一个Cloudflare Worker

  4. 创建一个KV容器

  5. 将KV容器绑定到Worker中(可以在Settings -> Variables下找到)

  6. 修改代码第一行的GITHUB_COPILOT_CHAT为你绑定KV namespace时使用的变量名称 绑定KV容器

  7. cf_copilot_service.js中的内容粘贴到Worker编辑器页面中

  8. 保存并部署Worker

  9. 打开任意支持自定义OpenAI Endpoint的前端应用

  10. 设置Endpoint为你的Worker地址,key为第2步中的token

  11. 设置完成

致谢

https://github.com/aaamoon/copilot-gpt4-service

About

License:Apache License 2.0


Languages

Language:JavaScript 100.0%