Compare commits

...

2 Commits

Author SHA1 Message Date
ParthSareen
c0bcd9731b cmd/config: fix droid model handling and naming
- Remove unused strings import
- Fix Ollama model identification logic to properly detect Ollama models
- Simplify model ID naming scheme by removing [Ollama] suffix
- Improve type assertions for better type safety
- Remove redundant helper function isOllamaModelEntry
2026-01-23 00:37:16 -08:00
ParthSareen
92cdc11126 cmd: fix droid 400 due to improper naming 2026-01-22 23:31:38 -08:00

View File

@@ -7,7 +7,6 @@ import (
"os/exec"
"path/filepath"
"slices"
"strings"
)
// Droid implements Runner and Editor for Droid integration
@@ -86,13 +85,19 @@ func (d *Droid) Edit(models []string) error {
customModels, _ := settings["customModels"].([]any)
// Keep only non-Ollama models (we'll rebuild Ollama models fresh)
nonOllamaModels := slices.DeleteFunc(slices.Clone(customModels), isOllamaModelEntry)
nonOllamaModels := slices.DeleteFunc(slices.Clone(customModels), func(m any) bool {
entry, ok := m.(droidModelEntry)
if !ok {
return false
}
return entry.APIKey != "ollama"
})
// Build new Ollama model entries with sequential indices (0, 1, 2, ...)
var ollamaModels []any
var defaultModelID string
for i, model := range models {
modelID := fmt.Sprintf("custom:%s-[Ollama]-%d", model, i)
modelID := fmt.Sprintf("custom:%s-%d", model, i)
ollamaModels = append(ollamaModels, droidModelEntry{
Model: model,
DisplayName: model,
@@ -140,20 +145,14 @@ func (d *Droid) Models() []string {
return nil
}
customModels, _ := settings["customModels"].([]any)
customModels, _ := settings["customModels"].([]droidModelEntry)
var result []string
for _, m := range customModels {
if !isOllamaModelEntry(m) {
if m.APIKey != "ollama" {
continue
}
entry, ok := m.(map[string]any)
if !ok {
continue
}
if model, _ := entry["model"].(string); model != "" {
result = append(result, model)
}
result = append(result, m.Model)
}
return result
}
@@ -163,12 +162,3 @@ var validReasoningEfforts = []string{"high", "medium", "low", "none"}
func isValidReasoningEffort(effort string) bool {
return slices.Contains(validReasoningEfforts, effort)
}
func isOllamaModelEntry(m any) bool {
entry, ok := m.(map[string]any)
if !ok {
return false
}
id, _ := entry["id"].(string)
return strings.Contains(id, "-[Ollama]-")
}