From 8b162ef34f0755e2224c43499218def16d4b6845 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 17 Jan 2026 11:42:35 +0300 Subject: Enha: change textview chat history based on current user persona --- helpfuncs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index 73f8fb0..ccb5858 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -109,7 +109,7 @@ func startNewChat() { } // set chat body chatBody.Messages = chatBody.Messages[:2] - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) newChat := &models.Chat{ ID: id + 1, Name: fmt.Sprintf("%d_%s", id+1, cfg.AssistantRole), -- cgit v1.2.3 From a28e8ef9e250ace5c9624393da308c189c0839f6 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 21 Jan 2026 21:01:01 +0300 Subject: Enha: charlist in cards --- helpfuncs.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index ccb5858..f74cd13 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -164,7 +164,7 @@ func setLogLevel(sl string) { } func listRolesWithUser() []string { - roles := chatBody.ListRoles() + roles := listChatRoles() // Remove user role if it exists in the list (to avoid duplicates and ensure it's at position 0) filteredRoles := make([]string, 0, len(roles)) for _, role := range roles { @@ -250,3 +250,26 @@ func randString(n int) string { } return string(b) } + +// set of roles within card definition and mention in chat history +func listChatRoles() []string { + currentChat, ok := chatMap[activeChatName] + cbc := chatBody.ListRoles() + if !ok { + return cbc + } + currentCard, ok := sysMap[currentChat.Agent] + if !ok { + // log error + logger.Warn("failed to find current card in sysMap", "agent", currentChat.Agent, "sysMap", sysMap) + return cbc + } + charset := []string{} + for _, name := range currentCard.Characters { + if !strInSlice(name, cbc) { + charset = append(charset, name) + } + } + charset = append(charset, cbc...) + return charset +} -- cgit v1.2.3 From 98138728542d0ed529d9d3a389c3531945d971f3 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Thu, 22 Jan 2026 09:29:56 +0300 Subject: Chore: bool colors for statusline --- helpfuncs.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'helpfuncs.go') 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 -- cgit v1.2.3 From 3a11210f52a850f84771e1642cafcc3027b85075 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 31 Jan 2026 12:57:53 +0300 Subject: Enha: avoid recursion in llm calls --- helpfuncs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index 28e7962..849b0a0 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -279,3 +279,16 @@ func listChatRoles() []string { charset = append(charset, cbc...) return charset } + +func deepseekModelValidator() error { + if cfg.CurrentAPI == cfg.DeepSeekChatAPI || cfg.CurrentAPI == cfg.DeepSeekCompletionAPI { + if chatBody.Model != "deepseek-chat" && chatBody.Model != "deepseek-reasoner" { + if err := notifyUser("bad request", "wrong deepseek model name"); err != nil { + logger.Warn("failed ot notify user", "error", err) + return err + } + return nil + } + } + return nil +} -- cgit v1.2.3 From 76f14ce4a376bbbb99c79cc2090c067b5ba28484 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 3 Feb 2026 16:56:31 +0300 Subject: Enha: detailed error --- helpfuncs.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index 849b0a0..49069a2 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -22,6 +22,28 @@ func isASCII(s string) bool { return true } +// refreshChatDisplay updates the chat display based on current character view +// It filters messages for the character the user is currently "writing as" +// and updates the textView with the filtered conversation +func refreshChatDisplay() { + // Determine which character's view to show + viewingAs := cfg.UserRole + if cfg.WriteNextMsgAs != "" { + viewingAs = cfg.WriteNextMsgAs + } + // Filter messages for this character + filteredMessages := filterMessagesForCharacter(chatBody.Messages, viewingAs) + displayText := chatToText(filteredMessages, cfg.ShowSys) + // Use QueueUpdate for thread-safe UI updates + app.QueueUpdate(func() { + textView.SetText(displayText) + colorText() + if scrollToEndEnabled { + textView.ScrollToEnd() + } + }) +} + func colorText() { text := textView.GetText(false) quoteReplacer := strings.NewReplacer( -- cgit v1.2.3 From e3965db3c7e7f5e3cdbf5d03ac06103c2709c0d8 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 4 Feb 2026 08:26:30 +0300 Subject: Enha: use slices methods --- helpfuncs.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index 49069a2..7033f04 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -7,6 +7,7 @@ import ( "image" "os" "path" + "slices" "strings" "unicode" @@ -198,6 +199,7 @@ func listRolesWithUser() []string { } // Prepend user role to the beginning of the list result := append([]string{cfg.UserRole}, filteredRoles...) + slices.Sort(result) return result } -- cgit v1.2.3 From d0722c6f98aa4755f271aefdd8af1cca28fb6f35 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Thu, 5 Feb 2026 08:24:51 +0300 Subject: Fix: add regen param for f2 --- helpfuncs.go | 1 - 1 file changed, 1 deletion(-) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index 7033f04..dff53b9 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -91,7 +91,6 @@ func colorText() { for i, cb := range codeBlocks { text = strings.Replace(text, fmt.Sprintf(placeholder, i), cb, 1) } - logger.Debug("thinking debug", "blocks", thinkBlocks) for i, tb := range thinkBlocks { text = strings.Replace(text, fmt.Sprintf(placeholderThink, i), tb, 1) } -- cgit v1.2.3 From 3f4d8a946775cfba6fc6d0ac7ade30b310bb883b Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Mon, 9 Feb 2026 11:29:47 +0300 Subject: Fix (f1): load from the card --- helpfuncs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'helpfuncs.go') diff --git a/helpfuncs.go b/helpfuncs.go index dff53b9..538b4aa 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -121,12 +121,12 @@ func initSysCards() ([]string, error) { return labels, nil } -func startNewChat() { +func startNewChat(keepSysP bool) { id, err := store.ChatGetMaxID() if err != nil { logger.Error("failed to get chat id", "error", err) } - if ok := charToStart(cfg.AssistantRole); !ok { + if ok := charToStart(cfg.AssistantRole, keepSysP); !ok { logger.Warn("no such sys msg", "name", cfg.AssistantRole) } // set chat body -- cgit v1.2.3