mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 03:04:21 +01:00
wip: refactoring tui
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user