fix: assistant message footer styles

This commit is contained in:
adamdotdevin
2025-08-11 10:50:00 -05:00
parent eb15b2ba75
commit c78cb57c41

View File

@@ -335,6 +335,10 @@ func renderText(
if time.Now().Format("02 Jan 2006") == timestamp[:11] { if time.Now().Format("02 Jan 2006") == timestamp[:11] {
timestamp = timestamp[12:] timestamp = timestamp[12:]
} }
timestamp = styles.NewStyle().
Background(backgroundColor).
Foreground(t.TextMuted()).
Render(" (" + timestamp + ")")
// Check if this is an assistant message with agent information // Check if this is an assistant message with agent information
var modelAndAgentSuffix string var modelAndAgentSuffix string
@@ -353,17 +357,23 @@ func renderText(
// Style the agent name with the same color as status bar // Style the agent name with the same color as status bar
agentName := cases.Title(language.Und).String(assistantMsg.Mode) agentName := cases.Title(language.Und).String(assistantMsg.Mode)
styledAgentName := styles.NewStyle().Foreground(agentColor).Render(agentName) styledAgentName := styles.NewStyle().
modelAndAgentSuffix = fmt.Sprintf("%s %s", styledAgentName, assistantMsg.ModelID) Background(backgroundColor).
Foreground(agentColor).
Render(agentName + " ")
styledModelID := styles.NewStyle().
Background(backgroundColor).
Foreground(t.TextMuted()).
Render(assistantMsg.ModelID)
modelAndAgentSuffix = styledAgentName + styledModelID
} }
var info string var info string
if modelAndAgentSuffix != "" { if modelAndAgentSuffix != "" {
info = fmt.Sprintf("%s (%s)", modelAndAgentSuffix, timestamp) info = modelAndAgentSuffix + timestamp
} else { } else {
info = fmt.Sprintf("%s (%s)", author, timestamp) info = author + timestamp
} }
info = styles.NewStyle().Foreground(t.TextMuted()).Render(info)
if !showToolDetails && toolCalls != nil && len(toolCalls) > 0 { if !showToolDetails && toolCalls != nil && len(toolCalls) > 0 {
content = content + "\n\n" content = content + "\n\n"
for _, toolCall := range toolCalls { for _, toolCall := range toolCalls {
@@ -378,10 +388,11 @@ func renderText(
} }
} }
sections := []string{content, info} sections := []string{content}
if extra != "" { if extra != "" {
sections = append(sections, "\n"+extra) sections = append(sections, "\n"+extra+"\n")
} }
sections = append(sections, info)
content = strings.Join(sections, "\n") content = strings.Join(sections, "\n")
switch message.(type) { switch message.(type) {