diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-01-17 11:42:35 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-01-17 11:42:35 +0300 |
| commit | 8b162ef34f0755e2224c43499218def16d4b6845 (patch) | |
| tree | 06c5a00c1f6680fbcf50dc5519887c5ff6a6f5c5 /bot.go | |
| parent | 12be6036902ba9fa1b403310422e5f6f3e6c1875 (diff) | |
Enha: change textview chat history based on current user persona
Diffstat (limited to 'bot.go')
| -rw-r--r-- | bot.go | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -153,7 +153,8 @@ func filterMessagesForCharacter(messages []models.RoleMsg, character string) []m return messages } filtered := make([]models.RoleMsg, 0, len(messages)) - for _, msg := range messages { + for i, msg := range messages { + logger.Info("filtering messages", "character", character, "index", i, "known_to", msg.KnownTo) // If KnownTo is nil or empty, message is visible to all if len(msg.KnownTo) == 0 { filtered = append(filtered, msg) @@ -1003,9 +1004,9 @@ func findCall(msg, toolCall string, tv *tview.TextView) { chatRound("", cfg.AssistantRole, tv, false, false) } -func chatToTextSlice(showSys bool) []string { - resp := make([]string, len(chatBody.Messages)) - for i, msg := range chatBody.Messages { +func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string { + resp := make([]string, len(messages)) + for i, msg := range messages { // INFO: skips system msg and tool msg if !showSys && (msg.Role == cfg.ToolRole || msg.Role == "system") { continue @@ -1015,8 +1016,8 @@ func chatToTextSlice(showSys bool) []string { return resp } -func chatToText(showSys bool) string { - s := chatToTextSlice(showSys) +func chatToText(messages []models.RoleMsg, showSys bool) string { + s := chatToTextSlice(messages, showSys) return strings.Join(s, "\n") } @@ -1140,7 +1141,7 @@ func summarizeAndStartNewChat() { } chatBody.Messages = append(chatBody.Messages, toolMsg) // Update UI - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) colorText() // Update storage if err := updateStorageChat(activeChatName, chatBody.Messages); err != nil { |
