Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

":Copilot model" fails with "Copilot: Could not retrieve completions models"

未关闭 适合新手
#305 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
vim
领域
tooling

调研方向

从 autoload/copilot.vim 中的 s:FmtModel() 和 s:commands.model() 开始,然后检查 completions 模型元数据请求的响应结构。验证该命令能够识别支持补全的模型,并按预期格式化单模型消息。使用 :Copilot model 重现问题,并确认它报告的是 GPT-4.1 Copilot,而不是检索错误。

由索引模型根据 Issue 内容生成。

描述

The current implementation seems to rely on model_picker_enabled being true however it's false for the only completion mode in use: gpt-41-copilot.

What I expect to see from :Copilot model:

Copilot: Current/only completions model is GPT-4.1 Copilot (gpt-41-copilot)

What I see instead:

Copilot: Could not retrieve completions models

Here is a minimal fix which makes it work:

diff --git a/autoload/copilot.vim b/autoload/copilot.vim
index dfdc443..936e975 100644
--- a/autoload/copilot.vim
+++ b/autoload/copilot.vim
@@ -774,7 +774,7 @@ function! s:commands.panel(opts) abort
 endfunction
 
 function! s:FmtModel(model) abort
-  return a:model.modelName . ' (' . a:model.id . ')'
+  return a:model.name . ' (' . a:model.id . ')'
 endfunction
 
 function! s:commands.model(opts) abort
@@ -782,11 +782,11 @@ function! s:commands.model(opts) abort
     return
   endif
   let client = copilot#Client()
-  let response = client.Request('copilot/models', {}).Wait()
+  let response = client.Request('copilot/models/getModelMetadataList', {}).Wait()
   if response.status ==# 'error'
     return 'echoerr ' . string('Copilot: Error retrieving completions models: ' . response.error.message)
   endif
-  let models = filter(response.result, { _, m -> index(m.scopes, 'completion') >= 0 })
+  let models = filter(response.result.models, { _, m -> m.capabilities.type ==# 'completion' })
   if len(models) == 0
     echo 'Copilot: Could not retrieve completions models'
   elseif len(models) == 1
主要语言
Vim Script
星标
11.7k
派生
821
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/copilot.vim 的其他 Issue

查看 github/copilot.vim 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。