summaryrefslogtreecommitdiff
path: root/tui.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-02-15 11:09:47 +0300
committerGrail Finder <wohilas@gmail.com>2025-02-15 11:09:47 +0300
commitc1344794143ef48670d8eeb365a10a5295a145ae (patch)
tree375a11525bd2117235043e4c1d95c5f842c9c202 /tui.go
parent83babd027140b7ae41743655fa016bf3551350c2 (diff)
Enha: log level to props
Diffstat (limited to 'tui.go')
-rw-r--r--tui.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/tui.go b/tui.go
index 948e363..8cbdf0b 100644
--- a/tui.go
+++ b/tui.go
@@ -135,7 +135,7 @@ func colorText() {
}
func updateStatusLine() {
- position.SetText(fmt.Sprintf(indexLine, botRespMode, cfg.AssistantRole, activeChatName, cfg.RAGEnabled, cfg.ToolUse, currentModel, cfg.CurrentAPI, cfg.ThinkUse))
+ position.SetText(fmt.Sprintf(indexLine, botRespMode, cfg.AssistantRole, activeChatName, cfg.RAGEnabled, cfg.ToolUse, currentModel, cfg.CurrentAPI, cfg.ThinkUse, logLevel.Level()))
}
func initSysCards() ([]string, error) {
@@ -180,16 +180,33 @@ func startNewChat() {
colorText()
}
+func setLogLevel(sl string) {
+ switch sl {
+ case "Debug":
+ logLevel.Set(-4)
+ case "Info":
+ logLevel.Set(0)
+ case "Warn":
+ logLevel.Set(4)
+ }
+}
+
func makePropsForm(props map[string]float32) *tview.Form {
+ // https://github.com/rivo/tview/commit/0a18dea458148770d212d348f656988df75ff341
+ // no way to close a form by a key press; a shame.
form := tview.NewForm().
AddTextView("Notes", "Props for llamacpp completion call", 40, 2, true, false).
AddCheckbox("Insert <think> (/completion only)", cfg.ThinkUse, func(checked bool) {
cfg.ThinkUse = checked
+ }).AddDropDown("Set log level (Enter): ", []string{"Debug", "Info", "Warn"}, 1,
+ func(option string, optionIndex int) {
+ setLogLevel(option)
}).
AddButton("Quit", func() {
pages.RemovePage(propsPage)
})
form.AddButton("Save", func() {
+ defer updateStatusLine()
defer pages.RemovePage(propsPage)
for pn := range props {
propField, ok := form.GetFormItemByLabel(pn).(*tview.InputField)
@@ -442,7 +459,7 @@ func init() {
text := textView.GetText(true)
assistantIcon := roleToIcon(cfg.AssistantRole)
if strings.HasSuffix(text, assistantIcon) {
- logger.Info("deleting assistant icon", "icon", assistantIcon)
+ logger.Debug("deleting assistant icon", "icon", assistantIcon)
textView.SetText(strings.TrimSuffix(text, assistantIcon))
colorText()
return nil