summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-02-24 10:31:01 +0300
committerGrail Finder <wohilas@gmail.com>2026-02-24 10:31:01 +0300
commitc39e1c267deed0480ee360ba942fe881772891c1 (patch)
treea53fc31b614a85f80060f0d8e9802cdc655182b6
parent9af21895c6d15e7ab648f35acd44afc9675b54b7 (diff)
Enha: loaded model on top
-rw-r--r--bot.go11
-rw-r--r--popups.go2
2 files changed, 10 insertions, 3 deletions
diff --git a/bot.go b/bot.go
index 04dadb4..1c24f9a 100644
--- a/bot.go
+++ b/bot.go
@@ -411,14 +411,21 @@ func fetchLCPModelsWithLoadStatus() ([]string, error) {
return nil, err
}
result := make([]string, 0, len(models.Data))
- for _, m := range models.Data {
+ li := 0 // loaded index
+ for i, m := range models.Data {
modelName := m.ID
if m.Status.Value == "loaded" {
modelName = "(loaded) " + modelName
+ li = i
}
result = append(result, modelName)
}
- return result, nil
+ if li == 0 {
+ return result, nil // no loaded models
+ }
+ loadedModel := result[li]
+ result = append(result[:li], result[li+1:]...)
+ return slices.Concat([]string{loadedModel}, result), nil
}
// fetchLCPModelsWithStatus returns the full LCPModels struct including status information.
diff --git a/popups.go b/popups.go
index 829a412..a1c3cd3 100644
--- a/popups.go
+++ b/popups.go
@@ -51,7 +51,7 @@ func showModelSelectionPopup() {
// Find the current model index to set as selected
currentModelIndex := -1
for i, model := range modelList {
- if model == chatBody.Model {
+ if strings.TrimPrefix(model, "(loaded) ") == chatBody.Model {
currentModelIndex = i
}
modelListWidget.AddItem(model, "", 0, nil)