请更新你的Override,VS Code Copilot chat 0.16.0 版本更新接口

VS Code Copilot chat 0.16.0 版本更新,出现Authorization header is badly formatted 问题

解决方法:请更新你的Override至 v 0.0.5 以上(如有)

0607更新

此处整理一下更新需要的步骤。

1. 拉取Overrride

请拉取最新版本Override
linux-do/override: 啥也不是 (github.com)

2. 修改路由文件并重新构建

修改override文件夹中的main.go,其中将路由函数修改为

func (s *ProxyService) InitRoutes(e *gin.Engine) {
	e.GET("/_ping", s.pong)
	e.GET("/models", s.models)
	authToken := s.cfg.AuthToken // replace with your dynamic value as needed
	if authToken != "" {
		// 鉴权
		v1 := e.Group("/:token/", AuthMiddleware(authToken))
		{
			v1.POST("/chat/completions", s.completions)
			v1.POST("/v1/engines/copilot-codex/completions", s.codeCompletions)
		}
	} else {
		e.POST("/chat/completions", s.completions)
		e.POST("/v1/engines/copilot-codex/completions", s.codeCompletions)
	}
}

重新构建并启动docker

$ docker compose build
$ docker compose up -d

3. 修改VSCode 设置

    "github.copilot.advanced": {
        "debug.overrideCAPIUrl": "http://127.0.0.1:8181",
        "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",

参考

Authorization header is badly formatted · Issue #35 · linux-do/override (github.com)

前情提要

CoCopilot 重大更新 - 一机难求 / 速来拼车 - LINUX DO

Cocopilot新配置 - 常规话题 / 人工智能 - LINUX DO

优雅一波:“啥也不是”的教程 - 软件分享 - LINUX DO

21 个赞

机器学习软件分享

更新后,提示这个问题,有什么办法呢,佬
image

请参照本贴最新内容,更新你的override

可以,错误解除

给楼主点赞。
修复错误

改了之后还是报错

Unable to resolve model with family selection: gpt-4
这个问题怎么解决呀

佬,请问一直请求的是/chat/completions而不是/v1/chat/completions是为什么呢?
有点奇怪看这个文件,似乎应该请求会缺少/v1的


我试过在"debug.overrideCAPIUrl": “https://xxxx.xyz” 后面的链接改为https://xxxx.xyz/v1 但是这样就是上面几位兄弟的错误,即找不到gpt-4模型了

欸?重启一下又好了,奇怪

镜像更新的话 用docker compose up -d --remove-orphans
不然没有down的话 还是会用旧镜像

按帖子进行更新

这样改了之后对idea有影响吗?

今天升级也遇到了, 另外出来佬提的,也可以直接使用

"debug.overrideCAPIUrl": "http://127.0.0.1:8181/v1",

然后将main.go 里面获取model时改成

e.GET("/v1/models", s.models)

全部照着做了,咋还报这个错啊:

2024-06-27 16:37:14.122 [info] [RemoteAgents] Invalid remote agent response: bad request: Authorization header is badly formatted
 (SyntaxError: Unexpected token 'b', "bad reques"... is not valid JSON)
2024-06-27 16:37:27.848 [info] [extension] Error: Unable to resolve model with family selection: gpt-4
    at Z2.getChatModel (/Users/bigo/.vscode/extensions/github.copilot-chat-0.16.1/dist/extension.js:1164:5671)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at IT.getChatEndpoint (/Users/bigo/.vscode/extensions/github.copilot-chat-0.16.1/dist/extension.js:1164:7377)
    at Function.createIntentInvocation (/Users/bigo/.vscode/extensions/github.copilot-chat-0.16.1/dist/extension.js:818:5585)
    at K6._provideResponseWithProgress (/Users/bigo/.vscode/extensions/github.copilot-chat-0.16.1/dist/extension.js:844:553)
    at K6.provideResponseWithProgress (/Users/bigo/.vscode/extensions/github.copilot-chat-0.16.1/dist/extension.js:842:8996)
    at n.z (/Users/bigo/.vscode/extensions/github.copilot-chat-0.16.1/dist/extension.js:854:1972)
    at m.$invokeAgent (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:153:49553)

我的 config.json:

{
  "bind": "127.0.0.1:8181",
  "proxy_url": "",
  "timeout": 600,
  "codex_api_base": "https://api.freegpt.art/v1",
  "codex_api_key": "sk-7Di7hGj4UHRcxxxxxxxx",
  "codex_api_organization": "",
  "codex_api_project": "",
  "code_instruct_model": "gpt-3.5-turbo-instruct",
  "chat_api_base": "https://api.freegpt.art/v1",
  "chat_api_key": "sk-7Di7hGj4UHRcsCDxxxxxx",
  "chat_api_organization": "",
  "chat_api_project": "",
  "chat_max_tokens": 4096,
  "chat_model_default": "gpt-4o",
  "chat_model_map": {},
  "chat_locale": "zh_CN",
  "auth_token": ""
}

VS 配置:

"github.copilot.advanced": {
        
        "debug.overrideCAPIUrl": "http://127.0.0.1:8181",
        "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",

我今天的突然不行了

你的是mac么. 同样的配置 win可以 mac是这个报错

哦莫,我咋没遇到

改造下代码,zeabur的Serverless可以部署一个override 速度没国内的快. :sweat_smile:

是的我是mac

我按照你的方法修改了,然后发现出现了 socket hang up 这样的错误。想问一下该怎么办呢?我已经把代理全部关掉了。还是这样。

1 个赞