summaryrefslogtreecommitdiff
path: root/props_table.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-02-10 11:05:09 +0300
committerGrail Finder <wohilas@gmail.com>2026-02-10 11:05:09 +0300
commit875de679cf4732bbd70361d826d65d9d8b190add (patch)
treee4ad90c2bdde747ad057e4e7d6e850c3173018fd /props_table.go
parent3b542421e35180db9b9f972ee973befc42f1a46f (diff)
parent37b98ad36cd7e63d96a190017b78fe35143a2e6a (diff)
Merge branch 'feat/char-secrets'
Diffstat (limited to 'props_table.go')
-rw-r--r--props_table.go61
1 files changed, 10 insertions, 51 deletions
diff --git a/props_table.go b/props_table.go
index a235d7c..a7ad067 100644
--- a/props_table.go
+++ b/props_table.go
@@ -2,7 +2,6 @@ package main
import (
"fmt"
- "slices"
"strconv"
"strings"
"sync"
@@ -53,7 +52,6 @@ func makePropsTable(props map[string]float32) *tview.Table {
row++
// Store cell data for later use in selection functions
cellData := make(map[string]*CellData)
- var modelCellID string // will be set for the model selection row
// Helper function to add a checkbox-like row
addCheckboxRow := func(label string, initialValue bool, onChange func(bool)) {
table.SetCell(row, 0,
@@ -137,6 +135,12 @@ func makePropsTable(props map[string]float32) *tview.Table {
// Reconfigure the app's mouse setting
app.EnableMouse(cfg.EnableMouse)
})
+ addCheckboxRow("Auto turn (for cards with many chars)", cfg.AutoTurn, func(checked bool) {
+ cfg.AutoTurn = checked
+ })
+ addCheckboxRow("Char specific context", cfg.CharSpecificContextEnabled, func(checked bool) {
+ cfg.CharSpecificContextEnabled = checked
+ })
// Add dropdowns
logLevels := []string{"Debug", "Info", "Warn"}
addListPopupRow("Set log level", logLevels, GetLogLevel(), func(option string) {
@@ -155,52 +159,6 @@ func makePropsTable(props map[string]float32) *tview.Table {
defer localModelsMu.RUnlock()
return LocalModels
}
- var modelRowIndex int // will be set before model row is added
- // 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
- newModelList := getModelListForAPI(cfg.CurrentAPI)
- if modelCellID != "" {
- if data := cellData[modelCellID]; data != nil {
- data.Options = newModelList
- }
- }
- // Ensure chatBody.Model is in the new list; if not, set to first available model
- if len(newModelList) > 0 && !slices.Contains(newModelList, chatBody.Model) {
- chatBody.Model = newModelList[0]
- cfg.CurrentModel = chatBody.Model
- // Update the displayed cell text - need to find model row
- // Search for model row by label
- for r := 0; r < table.GetRowCount(); r++ {
- if cell := table.GetCell(r, 0); cell != nil && cell.Text == "Select a model" {
- if valueCell := table.GetCell(r, 1); valueCell != nil {
- valueCell.SetText(chatBody.Model)
- }
- break
- }
- }
- }
- })
- // Prepare model list dropdown
- modelRowIndex = row
- modelCellID = fmt.Sprintf("listpopup_%d", modelRowIndex)
- modelList := getModelListForAPI(cfg.CurrentAPI)
- addListPopupRow("Select a model", modelList, chatBody.Model, func(option string) {
- chatBody.Model = option
- cfg.CurrentModel = chatBody.Model
- })
- // Role selection dropdown
- addListPopupRow("Write next message as", listRolesWithUser(), cfg.WriteNextMsgAs, func(option string) {
- cfg.WriteNextMsgAs = option
- })
// Add input fields
addInputRow("New char to write msg as", "", func(text string) {
if text != "" {
@@ -307,11 +265,12 @@ func makePropsTable(props map[string]float32) *tview.Table {
logger.Warn("empty options list for", "label", label, "api", cfg.CurrentAPI, "localModelsLen", len(LocalModels), "orModelsLen", len(ORFreeModels))
message := "No options available for " + label
if label == "Select a model" {
- if strings.Contains(cfg.CurrentAPI, "openrouter.ai") {
+ switch {
+ case strings.Contains(cfg.CurrentAPI, "openrouter.ai"):
message = "No OpenRouter models available. Check token and connection."
- } else if strings.Contains(cfg.CurrentAPI, "api.deepseek.com") {
+ case strings.Contains(cfg.CurrentAPI, "api.deepseek.com"):
message = "DeepSeek models should be available. Please report bug."
- } else {
+ default:
message = "No llama.cpp models loaded. Ensure llama.cpp server is running with models."
}
}