summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-12-16 21:52:03 +0300
committerGrail Finder <wohilas@gmail.com>2025-12-16 21:52:03 +0300
commit35851647a191f779943530591610a9b22ffaeff9 (patch)
treeb6bc2a5037653a8f656a0ed14cf26dacf88fe0ad
parent33f9ed2466e960223389da59a423cc697ff615ba (diff)
Fix: remove dulicate from apilinks list
-rw-r--r--props_table.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/props_table.go b/props_table.go
index dfbace8..774ea32 100644
--- a/props_table.go
+++ b/props_table.go
@@ -141,8 +141,14 @@ func makePropsTable(props map[string]float32) *tview.Table {
return LocalModels
}
var modelRowIndex int // will be set before model row is added
- // Prepare API links dropdown - insert current API at the beginning
- apiLinks := slices.Insert(cfg.ApiLinks, 0, cfg.CurrentAPI)
+ // Prepare API links dropdown - ensure current API is first, avoid duplicates
+ apiLinks := make([]string, 0, len(cfg.ApiLinks)+1)
+ apiLinks = append(apiLinks, cfg.CurrentAPI)
+ for _, api := range cfg.ApiLinks {
+ if api != cfg.CurrentAPI {
+ apiLinks = append(apiLinks, api)
+ }
+ }
addListPopupRow("Select an api", apiLinks, cfg.CurrentAPI, func(option string) {
cfg.CurrentAPI = option
// Update model list based on new API