Enha: update model status color

This commit is contained in:
Grail Finder
2026-02-22 19:06:45 +03:00
parent b7b5fcbf79
commit 850ca103e5

View File

@@ -61,14 +61,11 @@ func showModelSelectionPopup() {
modelListWidget.SetCurrentItem(currentModelIndex) modelListWidget.SetCurrentItem(currentModelIndex)
} }
modelListWidget.SetSelectedFunc(func(index int, mainText string, secondaryText string, shortcut rune) { modelListWidget.SetSelectedFunc(func(index int, mainText string, secondaryText string, shortcut rune) {
// Strip "(loaded)" suffix if present for local llama.cpp models
modelName := strings.TrimPrefix(mainText, "(loaded) ") modelName := strings.TrimPrefix(mainText, "(loaded) ")
// Update the model in both chatBody and config
chatBody.Model = modelName chatBody.Model = modelName
cfg.CurrentModel = chatBody.Model cfg.CurrentModel = chatBody.Model
// Remove the popup page
pages.RemovePage("modelSelectionPopup") pages.RemovePage("modelSelectionPopup")
// Update the status line to reflect the change updateCachedModelColor()
updateStatusLine() updateStatusLine()
}) })
modelListWidget.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { modelListWidget.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
@@ -162,10 +159,9 @@ func showAPILinkSelectionPopup() {
chatBody.Model = newModelList[0] chatBody.Model = newModelList[0]
cfg.CurrentModel = chatBody.Model cfg.CurrentModel = chatBody.Model
} }
// Remove the popup page
pages.RemovePage("apiLinkSelectionPopup") pages.RemovePage("apiLinkSelectionPopup")
// Update the parser and status line to reflect the change
choseChunkParser() choseChunkParser()
updateCachedModelColor()
updateStatusLine() updateStatusLine()
}) })
apiListWidget.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { apiListWidget.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {