tui fixes
This commit is contained in:
@@ -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}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user