"github.copilot.advanced": {
"debug.overrideProxyUrl": "http://127.0.0.1:8181",
"debug.chatOverrideProxyUrl": "http://127.0.0.1:8181/v1/chat/completions",
"authProvider": "github-enterprise"
},
"github-enterprise.uri": "https://cocopilot.org",按照 coco dash 页面截图配置后,执行对应系统的脚本后重启IDE:
scripts/install.sh适用于macOS和Linuxscripts/install-all-users.vbs适用于Windows,为电脑上所有用户配置,需要有管理员权限。scripts/install-current-user.vbs适用于Windows,为当前用户配置,无需管理员权限。scripts/uninstall相关脚本与之对应,为卸载配置。
其中 http://127.0.0.1:8181 是你启动的 override 服务地址。
{
"bind": "127.0.0.1:8181",
"proxy_url": "",
"timeout": 600,
"codex_api_base": "https://api-proxy.oaipro.com/v1",
"codex_api_key": "sk-xxx",
"codex_api_organization": "",
"codex_api_project": "",
"chat_api_base": "https://api-proxy.oaipro.com/v1",
"chat_api_key": "sk-xxx",
"chat_api_organization": "",
"chat_api_project": "",
"chat_max_tokens": 4096,
"chat_model_default": "gpt-4o",
"chat_model_map": {}
}organization 和 project 除非你有,且知道怎么回事再填。
chat_model_map 是个模型映射的字典。会将请求的模型映射到你想要的,如果不存在映射,则使用 chat_model_default 。
chat_max_tokens 可以设置为你希望的最大Token数,你设置的时候最好知道自己在做什么。gpt-4o 输出最大为 4096
可以通过 OVERRIDE_ + 大写配置项作为环境变量,可以覆盖 config.json 中的值。例如:OVERRIDE_CODEX_API_KEY=sk-xxxx
codex_max_tokens 工作并不完美,已经移除。JetBrains IDE 完美工作,VSCode 需要执行以下脚本Patch之:
- macOS
sed -i '' -E 's/\.maxPromptCompletionTokens\(([a-zA-Z0-9_]+),([0-9]+)\)/.maxPromptCompletionTokens(\1,2048)/' ~/.vscode/extensions/github.copilot-*/dist/extension.js - Linux
sed -E 's/\.maxPromptCompletionTokens\(([a-zA-Z0-9_]+),([0-9]+)\)/.maxPromptCompletionTokens(\1,2048)/' ~/.vscode/extensions/github.copilot-*/dist/extension.js - Windows 不知道怎么写,期待大佬PR。
- 因为是Patch,所以:Copilot每次升级都要执行一次。
- 具体原因是客户端需要根据
max_tokens精密计算prompt,后台删减会有问题。
- 理论上,Chat 部分可以使用
chat2api,而 Codex 代码生成部分则不太适合使用chat2api。 - 代码生成部分做过延时生成和客户端 Cancel 处理,很有效节省你的Token。
- 我目前就试了下
VSCode,至于JetBrains等IDE尚未适配,如果你有相关经验,请告诉我。 - 项目基于
MIT协议发布,你可以修改,请保留原作者信息。 - 有什么问题,请在论坛 https://linux.do 讨论,欢迎PR。