Enha: atomic global vars instead of mutexes
This commit is contained in:
@@ -4,14 +4,11 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
var _ = sync.RWMutex{}
|
||||
|
||||
// Define constants for cell types
|
||||
const (
|
||||
CellTypeCheckbox = "checkbox"
|
||||
@@ -157,9 +154,7 @@ func makePropsTable(props map[string]float32) *tview.Table {
|
||||
}
|
||||
// Assume local llama.cpp
|
||||
refreshLocalModelsIfEmpty()
|
||||
localModelsMu.RLock()
|
||||
defer localModelsMu.RUnlock()
|
||||
return LocalModels
|
||||
return LocalModels.Load().([]string)
|
||||
}
|
||||
// Add input fields
|
||||
addInputRow("New char to write msg as", "", func(text string) {
|
||||
@@ -262,7 +257,8 @@ func makePropsTable(props map[string]float32) *tview.Table {
|
||||
|
||||
// Check for empty options list
|
||||
if len(data.Options) == 0 {
|
||||
logger.Warn("empty options list for", "label", label, "api", cfg.CurrentAPI, "localModelsLen", len(LocalModels), "orModelsLen", len(ORFreeModels))
|
||||
localModels := LocalModels.Load().([]string)
|
||||
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" {
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user