Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions internal/components/sdd/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@ func extractModelFromAgent(agentMap map[string]any) model.ModelAssignment {
return model.ModelAssignment{}
}

// Try colon separator first (standard: "anthropic:claude-sonnet-4"), then slash.
idx := strings.Index(modelStr, ":")
if idx <= 0 {
idx = strings.Index(modelStr, "/")
// Find the FIRST occurrence of either '/' or ':' (whichever comes first).
// This correctly handles OpenRouter free models like "openrouter/qwen/qwen3.6-plus:free"
// where the provider is "openrouter" and the model is "qwen/qwen3.6-plus:free".
idx := -1
for i, c := range modelStr {
if c == '/' || c == ':' {
idx = i
break
}
}
if idx <= 0 {
return model.ModelAssignment{}
Expand Down
15 changes: 9 additions & 6 deletions internal/components/sdd/read_assignments.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sdd
import (
"encoding/json"
"os"
"strings"

"github.com/gentleman-programming/gentle-ai/internal/model"
"github.com/gentleman-programming/gentle-ai/internal/opencode"
Expand Down Expand Up @@ -77,11 +76,15 @@ func ReadCurrentModelAssignments(settingsPath string) (map[string]model.ModelAss
if !ok || modelStr == "" {
continue
}
// Try colon first (standard: "anthropic:claude-sonnet-4"), then slash
// ("zai-coding-plan/glm-5-turbo") for custom providers (issue #152).
idx := strings.Index(modelStr, ":")
if idx <= 0 {
idx = strings.Index(modelStr, "/")
// Find the FIRST occurrence of either '/' or ':' (whichever comes first).
// This correctly handles OpenRouter free models like "openrouter/qwen/qwen3.6-plus:free"
// where the provider is "openrouter" and the model is "qwen/qwen3.6-plus:free".
idx := -1
for i, c := range modelStr {
if c == '/' || c == ':' {
idx = i
break
}
}
if idx <= 0 {
// No separator or separator is the first character — skip malformed value.
Expand Down
Loading