diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-14 13:02:15 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-14 13:02:15 +0300 |
| commit | 090eb90ee7006715adeaf77ed78fb265b7310812 (patch) | |
| tree | 77c1ff675f190fc1b3cfd6fbea9bcc533f9c1daa /props_table.go | |
| parent | b1b007f0584efe2b6a553fb8996df6a997d56298 (diff) | |
Enha: notify user if model list is empty
Diffstat (limited to 'props_table.go')
| -rw-r--r-- | props_table.go | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/props_table.go b/props_table.go index 1861ca3..8cb956f 100644 --- a/props_table.go +++ b/props_table.go @@ -132,19 +132,12 @@ func makePropsTable(props map[string]float32) *tview.Table { }) // Helper function to get model list for a given API getModelListForAPI := func(api string) []string { - var list []string if strings.Contains(api, "api.deepseek.com/") { - list = []string{chatBody.Model, "deepseek-chat", "deepseek-reasoner"} + return []string{"deepseek-chat", "deepseek-reasoner"} } else if strings.Contains(api, "openrouter.ai") { - list = ORFreeModels - } else { - list = LocalModels + return ORFreeModels } - // Ensure current chatBody.Model is in the list - if len(list) > 0 && !slices.Contains(list, chatBody.Model) { - list = slices.Insert(list, 0, chatBody.Model) - } - return list + return LocalModels } var modelRowIndex int // will be set before model row is added @@ -256,6 +249,20 @@ func makePropsTable(props map[string]float32) *tview.Table { if cellData[listPopupCellID] != nil && cellData[listPopupCellID].Type == CellTypeListPopup { data := cellData[listPopupCellID] if onChange, ok := data.OnChange.(func(string)); ok && data.Options != nil { + // Check for empty options list + if len(data.Options) == 0 { + // Get label for context + labelCell := table.GetCell(selectedRow, 0) + label := "item" + if labelCell != nil { + label = labelCell.Text + } + logger.Warn("empty options list for", "label", label) + if err := notifyUser("Empty list", "No options available for " + label); err != nil { + logger.Error("failed to send notification", "error", err) + } + return + } // Create a list primitive apiList := tview.NewList().ShowSecondaryText(false). SetSelectedBackgroundColor(tcell.ColorGray) |
