Fix (cli): tui panics

This commit is contained in:
Grail Finder
2026-04-11 16:07:15 +03:00
parent 76cc48eb54
commit 50035e667b
3 changed files with 31 additions and 1 deletions

View File

@@ -98,6 +98,9 @@ func stripThinkingFromMsg(msg *models.RoleMsg) *models.RoleMsg {
// It filters messages for the character the user is currently "writing as"
// and updates the textView with the filtered conversation
func refreshChatDisplay() {
if cfg.CLIMode {
return
}
// Determine which character's view to show
viewingAs := cfg.UserRole
if cfg.WriteNextMsgAs != "" {
@@ -183,6 +186,9 @@ func colorText() {
}
func updateStatusLine() {
if cfg.CLIMode {
return // no status line in cli mode
}
status := makeStatusLine()
statusLineWidget.SetText(status)
}
@@ -1023,3 +1029,19 @@ func GetCardByRole(role string) *models.CharCard {
}
return sysMap[cardID]
}
func notifySend(topic, message string) error {
// Sanitize message to remove control characters that notify-send doesn't handle
sanitized := strings.Map(func(r rune) rune {
if r < 32 && r != '\t' {
return -1
}
return r
}, message)
// Truncate if too long
if len(sanitized) > 200 {
sanitized = sanitized[:197] + "..."
}
cmd := exec.Command("notify-send", topic, sanitized)
return cmd.Run()
}