Chore: bool colors for statusline
This commit is contained in:
30
bot.go
30
bot.go
@@ -35,19 +35,18 @@ var (
|
|||||||
logLevel = new(slog.LevelVar)
|
logLevel = new(slog.LevelVar)
|
||||||
)
|
)
|
||||||
var (
|
var (
|
||||||
activeChatName string
|
activeChatName string
|
||||||
chunkChan = make(chan string, 10)
|
chunkChan = make(chan string, 10)
|
||||||
openAIToolChan = make(chan string, 10)
|
openAIToolChan = make(chan string, 10)
|
||||||
streamDone = make(chan bool, 1)
|
streamDone = make(chan bool, 1)
|
||||||
chatBody *models.ChatBody
|
chatBody *models.ChatBody
|
||||||
store storage.FullRepo
|
store storage.FullRepo
|
||||||
defaultFirstMsg = "Hello! What can I do for you?"
|
defaultFirstMsg = "Hello! What can I do for you?"
|
||||||
defaultStarter = []models.RoleMsg{}
|
defaultStarter = []models.RoleMsg{}
|
||||||
defaultStarterBytes = []byte{}
|
interruptResp = false
|
||||||
interruptResp = false
|
ragger *rag.RAG
|
||||||
ragger *rag.RAG
|
chunkParser ChunkParser
|
||||||
chunkParser ChunkParser
|
lastToolCall *models.FuncCall
|
||||||
lastToolCall *models.FuncCall
|
|
||||||
//nolint:unused // TTS_ENABLED conditionally uses this
|
//nolint:unused // TTS_ENABLED conditionally uses this
|
||||||
orator Orator
|
orator Orator
|
||||||
asr STT
|
asr STT
|
||||||
@@ -1170,11 +1169,6 @@ func init() {
|
|||||||
slog.Error("failed to open log file", "error", err, "filename", cfg.LogFile)
|
slog.Error("failed to open log file", "error", err, "filename", cfg.LogFile)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defaultStarterBytes, err = json.Marshal(defaultStarter)
|
|
||||||
if err != nil {
|
|
||||||
slog.Error("failed to marshal defaultStarter", "error", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// load cards
|
// load cards
|
||||||
basicCard.Role = cfg.AssistantRole
|
basicCard.Role = cfg.AssistantRole
|
||||||
// toolCard.Role = cfg.AssistantRole
|
// toolCard.Role = cfg.AssistantRole
|
||||||
|
|||||||
18
helpfuncs.go
18
helpfuncs.go
@@ -111,9 +111,11 @@ func startNewChat() {
|
|||||||
chatBody.Messages = chatBody.Messages[:2]
|
chatBody.Messages = chatBody.Messages[:2]
|
||||||
textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys))
|
textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys))
|
||||||
newChat := &models.Chat{
|
newChat := &models.Chat{
|
||||||
ID: id + 1,
|
ID: id + 1,
|
||||||
Name: fmt.Sprintf("%d_%s", id+1, cfg.AssistantRole),
|
Name: fmt.Sprintf("%d_%s", id+1, cfg.AssistantRole),
|
||||||
Msgs: string(defaultStarterBytes),
|
// 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,
|
Agent: cfg.AssistantRole,
|
||||||
}
|
}
|
||||||
activeChatName = newChat.Name
|
activeChatName = newChat.Name
|
||||||
@@ -235,9 +237,10 @@ func makeStatusLine() string {
|
|||||||
} else {
|
} else {
|
||||||
shellModeInfo = ""
|
shellModeInfo = ""
|
||||||
}
|
}
|
||||||
statusLine := fmt.Sprintf(indexLineCompletion, botRespMode, activeChatName,
|
statusLine := fmt.Sprintf(indexLineCompletion, boolColors[botRespMode], botRespMode, activeChatName,
|
||||||
cfg.ToolUse, chatBody.Model, cfg.SkipLLMResp, cfg.CurrentAPI,
|
boolColors[cfg.ToolUse], cfg.ToolUse, chatBody.Model, boolColors[cfg.SkipLLMResp],
|
||||||
isRecording, persona, botPersona, injectRole)
|
cfg.SkipLLMResp, cfg.CurrentAPI, boolColors[isRecording], isRecording, persona,
|
||||||
|
botPersona, boolColors[injectRole], injectRole)
|
||||||
return statusLine + imageInfo + shellModeInfo
|
return statusLine + imageInfo + shellModeInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +263,9 @@ func listChatRoles() []string {
|
|||||||
}
|
}
|
||||||
currentCard, ok := sysMap[currentChat.Agent]
|
currentCard, ok := sysMap[currentChat.Agent]
|
||||||
if !ok {
|
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
|
// log error
|
||||||
logger.Warn("failed to find current card in sysMap", "agent", currentChat.Agent, "sysMap", sysMap)
|
logger.Warn("failed to find current card in sysMap", "agent", currentChat.Agent, "sysMap", sysMap)
|
||||||
return cbc
|
return cbc
|
||||||
|
|||||||
6
main.go
6
main.go
@@ -8,6 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
boolColors = map[bool]string{true: "green", false: "red"}
|
||||||
botRespMode = false
|
botRespMode = false
|
||||||
editMode = false
|
editMode = false
|
||||||
roleEditMode = false
|
roleEditMode = false
|
||||||
@@ -17,9 +18,8 @@ var (
|
|||||||
currentORModelIndex = 0 // Index to track current OpenRouter model in ORFreeModels slice
|
currentORModelIndex = 0 // Index to track current OpenRouter model in ORFreeModels slice
|
||||||
currentLocalModelIndex = 0 // Index to track current llama.cpp model
|
currentLocalModelIndex = 0 // Index to track current llama.cpp model
|
||||||
shellMode = false
|
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 | 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[-:-:-]"
|
||||||
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{}
|
||||||
focusSwitcher = map[tview.Primitive]tview.Primitive{}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
7
tui.go
7
tui.go
@@ -832,13 +832,6 @@ func init() {
|
|||||||
// Handle Alt+7 to toggle injectRole
|
// Handle Alt+7 to toggle injectRole
|
||||||
if event.Key() == tcell.KeyRune && event.Rune() == '7' && event.Modifiers()&tcell.ModAlt != 0 {
|
if event.Key() == tcell.KeyRune && event.Rune() == '7' && event.Modifiers()&tcell.ModAlt != 0 {
|
||||||
injectRole = !injectRole
|
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()
|
updateStatusLine()
|
||||||
}
|
}
|
||||||
if event.Key() == tcell.KeyF1 {
|
if event.Key() == tcell.KeyF1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user