summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-01-22 09:29:56 +0300
committerGrail Finder <wohilas@gmail.com>2026-01-22 09:29:56 +0300
commit98138728542d0ed529d9d3a389c3531945d971f3 (patch)
tree0ad2e4e7f255632a7c712a7566580f2aec03a02b
parenta28e8ef9e250ace5c9624393da308c189c0839f6 (diff)
Chore: bool colors for statusline
-rw-r--r--bot.go30
-rw-r--r--helpfuncs.go18
-rw-r--r--main.go6
-rw-r--r--tui.go7
4 files changed, 27 insertions, 34 deletions
diff --git a/bot.go b/bot.go
index 112af07..cd35445 100644
--- a/bot.go
+++ b/bot.go
@@ -35,19 +35,18 @@ var (
logLevel = new(slog.LevelVar)
)
var (
- activeChatName string
- chunkChan = make(chan string, 10)
- openAIToolChan = make(chan string, 10)
- streamDone = make(chan bool, 1)
- chatBody *models.ChatBody
- store storage.FullRepo
- defaultFirstMsg = "Hello! What can I do for you?"
- defaultStarter = []models.RoleMsg{}
- defaultStarterBytes = []byte{}
- interruptResp = false
- ragger *rag.RAG
- chunkParser ChunkParser
- lastToolCall *models.FuncCall
+ activeChatName string
+ chunkChan = make(chan string, 10)
+ openAIToolChan = make(chan string, 10)
+ streamDone = make(chan bool, 1)
+ chatBody *models.ChatBody
+ store storage.FullRepo
+ defaultFirstMsg = "Hello! What can I do for you?"
+ defaultStarter = []models.RoleMsg{}
+ interruptResp = false
+ ragger *rag.RAG
+ chunkParser ChunkParser
+ lastToolCall *models.FuncCall
//nolint:unused // TTS_ENABLED conditionally uses this
orator Orator
asr STT
@@ -1170,11 +1169,6 @@ func init() {
slog.Error("failed to open log file", "error", err, "filename", cfg.LogFile)
return
}
- defaultStarterBytes, err = json.Marshal(defaultStarter)
- if err != nil {
- slog.Error("failed to marshal defaultStarter", "error", err)
- return
- }
// load cards
basicCard.Role = cfg.AssistantRole
// toolCard.Role = cfg.AssistantRole
diff --git a/helpfuncs.go b/helpfuncs.go
index f74cd13..28e7962 100644
--- a/helpfuncs.go
+++ b/helpfuncs.go
@@ -111,9 +111,11 @@ func startNewChat() {
chatBody.Messages = chatBody.Messages[:2]
textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys))
newChat := &models.Chat{
- ID: id + 1,
- Name: fmt.Sprintf("%d_%s", id+1, cfg.AssistantRole),
- Msgs: string(defaultStarterBytes),
+ ID: id + 1,
+ Name: fmt.Sprintf("%d_%s", id+1, cfg.AssistantRole),
+ // chat is written to db when we get first llm response (or any)
+ // actual chat history (messages) would be parsed then
+ Msgs: "",
Agent: cfg.AssistantRole,
}
activeChatName = newChat.Name
@@ -235,9 +237,10 @@ func makeStatusLine() string {
} else {
shellModeInfo = ""
}
- statusLine := fmt.Sprintf(indexLineCompletion, botRespMode, activeChatName,
- cfg.ToolUse, chatBody.Model, cfg.SkipLLMResp, cfg.CurrentAPI,
- isRecording, persona, botPersona, injectRole)
+ statusLine := fmt.Sprintf(indexLineCompletion, boolColors[botRespMode], botRespMode, activeChatName,
+ boolColors[cfg.ToolUse], cfg.ToolUse, chatBody.Model, boolColors[cfg.SkipLLMResp],
+ cfg.SkipLLMResp, cfg.CurrentAPI, boolColors[isRecording], isRecording, persona,
+ botPersona, boolColors[injectRole], injectRole)
return statusLine + imageInfo + shellModeInfo
}
@@ -260,6 +263,9 @@ func listChatRoles() []string {
}
currentCard, ok := sysMap[currentChat.Agent]
if !ok {
+ // case which won't let to switch roles:
+ // started new chat (basic_sys or any other), at the start it yet be saved or have chatbody
+ // if it does not have a card or chars, it'll return an empty slice
// log error
logger.Warn("failed to find current card in sysMap", "agent", currentChat.Agent, "sysMap", sysMap)
return cbc
diff --git a/main.go b/main.go
index c375d95..0f2df2e 100644
--- a/main.go
+++ b/main.go
@@ -8,6 +8,7 @@ import (
)
var (
+ boolColors = map[bool]string{true: "green", false: "red"}
botRespMode = false
editMode = false
roleEditMode = false
@@ -17,9 +18,8 @@ var (
currentORModelIndex = 0 // Index to track current OpenRouter model in ORFreeModels slice
currentLocalModelIndex = 0 // Index to track current llama.cpp model
shellMode = false
- // indexLine = "F12 to show keys help | bot resp mode: [orange:-:b]%v[-:-:-] (F6) | card's char: [orange:-:b]%s[-:-:-] (ctrl+s) | chat: [orange:-:b]%s[-:-:-] (F1) | toolUseAdviced: [orange:-:b]%v[-:-:-] (ctrl+k) | model: [orange:-:b]%s[-:-:-] (ctrl+l) | skip LLM resp: [orange:-:b]%v[-:-:-] (F10)\nAPI_URL: [orange:-:b]%s[-:-:-] (ctrl+v) | ThinkUse: [orange:-:b]%v[-:-:-] (ctrl+p) | Log Level: [orange:-:b]%v[-:-:-] (ctrl+p) | Recording: [orange:-:b]%v[-:-:-] (ctrl+r) | Writing as: [orange:-:b]%s[-:-:-] (ctrl+q)"
- indexLineCompletion = "F12 to show keys help | bot resp mode: [orange:-:b]%v[-:-:-] (F6) | chat: [orange:-:b]%s[-:-:-] (F1) | toolUseAdviced: [orange:-:b]%v[-:-:-] (ctrl+k) | model: [orange:-:b]%s[-:-:-] (ctrl+l) | skip LLM resp: [orange:-:b]%v[-:-:-] (F10)\nAPI: [orange:-:b]%s[-:-:-] (ctrl+v) | Recording: [orange:-:b]%v[-:-:-] (ctrl+r) | Writing as: [orange:-:b]%s[-:-:-] (ctrl+q) | Bot will write as [orange:-:b]%s[-:-:-] (ctrl+x) | role_inject [orange:-:b]%v[-:-:-]"
- focusSwitcher = map[tview.Primitive]tview.Primitive{}
+ indexLineCompletion = "F12 to show keys help | llm turn: [%s:-:b]%v[-:-:-] (F6) | chat: [orange:-:b]%s[-:-:-] (F1) | toolUseAdviced: [%s:-:b]%v[-:-:-] (ctrl+k) | model: [orange:-:b]%s[-:-:-] (ctrl+l) | skip LLM resp: [%s:-:b]%v[-:-:-] (F10)\nAPI: [orange:-:b]%s[-:-:-] (ctrl+v) | recording: [%s:-:b]%v[-:-:-] (ctrl+r) | writing as: [orange:-:b]%s[-:-:-] (ctrl+q) | bot will write as [orange:-:b]%s[-:-:-] (ctrl+x) | role injection (alt+7) [%s:-:b]%v[-:-:-]"
+ focusSwitcher = map[tview.Primitive]tview.Primitive{}
)
func main() {
diff --git a/tui.go b/tui.go
index 54a4e32..d222d15 100644
--- a/tui.go
+++ b/tui.go
@@ -832,13 +832,6 @@ func init() {
// Handle Alt+7 to toggle injectRole
if event.Key() == tcell.KeyRune && event.Rune() == '7' && event.Modifiers()&tcell.ModAlt != 0 {
injectRole = !injectRole
- status := "disabled"
- if injectRole {
- status = "enabled"
- }
- if err := notifyUser("injectRole", "Role injection "+status); err != nil {
- logger.Error("failed to send notification", "error", err)
- }
updateStatusLine()
}
if event.Key() == tcell.KeyF1 {