wip: refactoring tui

This commit is contained in:
adamdottv
2025-06-04 13:52:23 -05:00
parent f34a3b6f67
commit 093e64eb54
6 changed files with 70 additions and 50 deletions

View File

@@ -108,7 +108,7 @@ func (m *messagesCmp) renderView() {
content := renderUserMessage(m.app.Info.User, msg, m.width)
messages = append(messages, content+"\n")
case client.Assistant:
content := renderAssistantMessage(msg, m.width, m.showToolMessages)
content := renderAssistantMessage(msg, m.width, m.showToolMessages, *m.app.Info)
messages = append(messages, content+"\n")
}
}
@@ -215,9 +215,7 @@ func (m *messagesCmp) working() string {
baseStyle := styles.BaseStyle()
task := ""
lastMessage := m.app.Messages[len(m.app.Messages)-1]
if lastMessage.Metadata.Time.Completed == nil {
if m.app.IsBusy() {
task = "Working..."
}
// lastMessage := m.app.Messages[len(m.app.Messages)-1]
@@ -245,28 +243,28 @@ func (m *messagesCmp) help() string {
text := ""
// if m.app.PrimaryAgentOLD.IsBusy() {
// text += lipgloss.JoinHorizontal(
// lipgloss.Left,
// baseStyle.Foreground(t.TextMuted()).Bold(true).Render("press "),
// baseStyle.Foreground(t.Text()).Bold(true).Render("esc"),
// baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" to interrupt"),
// )
// } else {
text += lipgloss.JoinHorizontal(
lipgloss.Left,
baseStyle.Foreground(t.Text()).Bold(true).Render("enter"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" to send,"),
baseStyle.Foreground(t.Text()).Bold(true).Render(" \\"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render("+"),
baseStyle.Foreground(t.Text()).Bold(true).Render("enter"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" for newline,"),
baseStyle.Foreground(t.Text()).Bold(true).Render(" ↑↓"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" for history,"),
baseStyle.Foreground(t.Text()).Bold(true).Render(" ctrl+h"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" to toggle tool messages"),
)
// }
if m.app.IsBusy() {
text += lipgloss.JoinHorizontal(
lipgloss.Left,
baseStyle.Foreground(t.TextMuted()).Bold(true).Render("press "),
baseStyle.Foreground(t.Text()).Bold(true).Render("esc"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" to interrupt"),
)
} else {
text += lipgloss.JoinHorizontal(
lipgloss.Left,
baseStyle.Foreground(t.Text()).Bold(true).Render("enter"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" to send,"),
baseStyle.Foreground(t.Text()).Bold(true).Render(" \\"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render("+"),
baseStyle.Foreground(t.Text()).Bold(true).Render("enter"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" for newline,"),
baseStyle.Foreground(t.Text()).Bold(true).Render(" ↑↓"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" for history,"),
baseStyle.Foreground(t.Text()).Bold(true).Render(" ctrl+h"),
baseStyle.Foreground(t.TextMuted()).Bold(true).Render(" to toggle tool messages"),
)
}
return baseStyle.
Width(m.width).
Render(text)