tui: adjust message header styling
This commit is contained in:
parent
6cb8d03c5b
commit
51e6f6ebf6
@ -72,8 +72,8 @@ type (
|
|||||||
|
|
||||||
// styles
|
// styles
|
||||||
var (
|
var (
|
||||||
userStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("10"))
|
userStyle = lipgloss.NewStyle().Faint(true).Bold(true).Foreground(lipgloss.Color("10"))
|
||||||
assistantStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12"))
|
assistantStyle = lipgloss.NewStyle().Faint(true).Bold(true).Foreground(lipgloss.Color("12"))
|
||||||
messageStyle = lipgloss.NewStyle().PaddingLeft(1)
|
messageStyle = lipgloss.NewStyle().PaddingLeft(1)
|
||||||
headerStyle = lipgloss.NewStyle().
|
headerStyle = lipgloss.NewStyle().
|
||||||
PaddingLeft(1).
|
PaddingLeft(1).
|
||||||
@ -326,14 +326,23 @@ func (m *model) updateContent() {
|
|||||||
sb := strings.Builder{}
|
sb := strings.Builder{}
|
||||||
msgCnt := len(m.messages)
|
msgCnt := len(m.messages)
|
||||||
for i, message := range m.messages {
|
for i, message := range m.messages {
|
||||||
var style lipgloss.Style
|
icon := "⚙️"
|
||||||
if message.Role == models.MessageRoleUser {
|
friendly := message.Role.FriendlyRole()
|
||||||
|
style := lipgloss.NewStyle().Bold(true).Faint(true)
|
||||||
|
|
||||||
|
switch message.Role {
|
||||||
|
case models.MessageRoleUser:
|
||||||
|
icon = ""
|
||||||
style = userStyle
|
style = userStyle
|
||||||
} else {
|
case models.MessageRoleAssistant:
|
||||||
|
icon = ""
|
||||||
style = assistantStyle
|
style = assistantStyle
|
||||||
|
case models.MessageRoleToolCall:
|
||||||
|
case models.MessageRoleToolResult:
|
||||||
|
icon = "🔧"
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.WriteString(fmt.Sprintf("%s:\n\n", style.Render(string(message.Role.FriendlyRole()))))
|
sb.WriteString(fmt.Sprintf("%s\n\n", style.Render(icon + friendly)))
|
||||||
|
|
||||||
highlighted, _ := m.ctx.Chroma.HighlightS(message.Content)
|
highlighted, _ := m.ctx.Chroma.HighlightS(message.Content)
|
||||||
sb.WriteString(messageStyle.Width(m.content.Width - 5).Render(highlighted))
|
sb.WriteString(messageStyle.Width(m.content.Width - 5).Render(highlighted))
|
||||||
|
Loading…
Reference in New Issue
Block a user