tui fixes

This commit is contained in:
Luxferre
2026-03-23 00:06:24 +02:00
parent 4e43d84e2d
commit f931203cda
2 changed files with 19 additions and 2 deletions
+17 -1
View File
@@ -90,6 +90,22 @@ func (m model) userMessages() []string {
return msgs
}
func filterHistory(h []sidekick.Message) []sidekick.Message {
var history []sidekick.Message
for _, msg := range h {
if msg.Role == sidekick.MessageRoleSystem {
// Filter out TUI-specific system messages that are for display only
if strings.HasPrefix(msg.Content, banner) ||
msg.Content == "Request cancelled." ||
strings.HasPrefix(msg.Content, "Error: ") {
continue
}
}
history = append(history, msg)
}
return history
}
type agentResponseMsg struct {
response string
err error
@@ -493,7 +509,7 @@ func (m *model) runAgent() tea.Cmd {
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())
return func() tea.Msg {
res, err := m.agent.Run(ctx, m.history, m.pool)
res, err := m.agent.Run(ctx, filterHistory(m.history), m.pool)
return agentResponseMsg{response: res, err: err}
}
}