Skip to content

Commit 1bdcafd

Browse files
committed
feat(config): include new Copilot models - GPT-4.1 and Raptor mini -
1 parent 6402f80 commit 1bdcafd

2 files changed

Lines changed: 32 additions & 8 deletions

File tree

cmd/config.go

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,22 +158,39 @@ func runInteractiveConfig() {
158158
fmt.Println("Anthropic provider uses Claude Code CLI - no API key needed.")
159159
}
160160

161-
// Dynamically generate available models
162161
availableModels := map[string][]string{
163162
"openai": {},
164-
"copilot": {"openai/gpt-5-mini"},
163+
"copilot": {},
165164
"anthropic": {},
166165
}
167166

168167
modelDisplayToID := map[string]string{}
169168

170-
if selectedProvider == "openai" {
169+
switch selectedProvider {
170+
case "copilot":
171+
copilotModels := []struct {
172+
Display string
173+
ID string
174+
}{
175+
176+
{Display: "Auto", ID: "auto"},
177+
{Display: "GPT-4.1", ID: "gpt-4.1"},
178+
{Display: "GPT-4o", ID: "gpt-4o"},
179+
{Display: "GPT-5 mini", ID: "gpt-5-mini"},
180+
{Display: "Grok Code Fast 1", ID: "grok-code-fast-1"},
181+
{Display: "Raptor mini (Preview)", ID: "raptor-mini"},
182+
}
183+
for _, m := range copilotModels {
184+
availableModels["copilot"] = append(availableModels["copilot"], m.Display)
185+
modelDisplayToID[m.Display] = m.ID
186+
}
187+
case "openai":
171188
for id, m := range models.OpenAIModels {
172189
display := fmt.Sprintf("%s (%s)", m.Name, string(id))
173190
availableModels["openai"] = append(availableModels["openai"], display)
174191
modelDisplayToID[display] = string(id)
175192
}
176-
} else if selectedProvider == "anthropic" {
193+
case "anthropic":
177194
for _, m := range models.AnthropicModels {
178195
display := fmt.Sprintf("%s (%s)", m.Name, m.APIModel)
179196
availableModels["anthropic"] = append(availableModels["anthropic"], display)
@@ -189,7 +206,7 @@ func runInteractiveConfig() {
189206
// Try to set the default to the current model if possible
190207
isValidDefault := false
191208
currentDisplay := ""
192-
if selectedProvider == "openai" || selectedProvider == "anthropic" {
209+
if selectedProvider == "openai" || selectedProvider == "anthropic" || selectedProvider == "copilot" {
193210
for display, id := range modelDisplayToID {
194211
if id == currentModel || display == currentModel {
195212
isValidDefault = true
@@ -218,7 +235,7 @@ func runInteractiveConfig() {
218235
}
219236

220237
selectedModel := selectedDisplay
221-
if selectedProvider == "openai" || selectedProvider == "anthropic" {
238+
if selectedProvider == "openai" || selectedProvider == "anthropic" || selectedProvider == "copilot" {
222239
selectedModel = modelDisplayToID[selectedDisplay]
223240
}
224241

internal/provider/copilot.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func normalizeCopilotModel(model string) string {
7171
if m == "" {
7272
return "gpt-4o"
7373
}
74+
if strings.EqualFold(m, "auto") {
75+
return ""
76+
}
7477
if strings.Contains(m, "/") {
7578
parts := strings.SplitN(m, "/", 2)
7679
if len(parts) == 2 && parts[1] != "" {
@@ -222,12 +225,14 @@ func (c *CopilotProvider) GenerateCommitMessages(ctx context.Context, diff strin
222225
}
223226

224227
params := openai.ChatCompletionNewParams{
225-
Model: openai.ChatModel(c.model),
226228
Messages: []openai.ChatCompletionMessageParamUnion{
227229
{OfSystem: &openai.ChatCompletionSystemMessageParam{Content: openai.ChatCompletionSystemMessageParamContentUnion{OfString: openai.String(GetSystemMessage())}}},
228230
{OfUser: &openai.ChatCompletionUserMessageParam{Content: openai.ChatCompletionUserMessageParamContentUnion{OfString: openai.String(GetCommitMessagePrompt(diff))}}},
229231
},
230232
}
233+
if c.model != "" {
234+
params.Model = openai.ChatModel(c.model)
235+
}
231236

232237
resp, err := client.Chat.Completions.New(ctx, params)
233238
if err != nil {
@@ -279,12 +284,14 @@ func (c *CopilotProvider) GeneratePRTitles(ctx context.Context, diff string) ([]
279284
}
280285

281286
params := openai.ChatCompletionNewParams{
282-
Model: openai.ChatModel(c.model),
283287
Messages: []openai.ChatCompletionMessageParamUnion{
284288
{OfSystem: &openai.ChatCompletionSystemMessageParam{Content: openai.ChatCompletionSystemMessageParamContentUnion{OfString: openai.String(GetSystemMessage())}}},
285289
{OfUser: &openai.ChatCompletionUserMessageParam{Content: openai.ChatCompletionUserMessageParamContentUnion{OfString: openai.String(GetPRTitlePrompt(diff))}}},
286290
},
287291
}
292+
if c.model != "" {
293+
params.Model = openai.ChatModel(c.model)
294+
}
288295

289296
resp, err := client.Chat.Completions.New(ctx, params)
290297
if err != nil {

0 commit comments

Comments
 (0)