fix: reformat assistant message footer

This commit is contained in:
adamdotdevin
2025-08-11 09:38:52 -05:00
parent a760e8364f
commit e8d144d2a2

View File

@@ -225,6 +225,9 @@ func renderText(
bg = t.BackgroundPanel() bg = t.BackgroundPanel()
} }
ts = time.UnixMilli(int64(casted.Time.Created)) ts = time.UnixMilli(int64(casted.Time.Created))
if casted.Time.Completed > 0 {
ts = time.UnixMilli(int64(casted.Time.Completed))
}
content = util.ToMarkdown(text, width, bg) content = util.ToMarkdown(text, width, bg)
if isThinking { if isThinking {
content = styles.NewStyle().Background(bg).Foreground(t.TextMuted()).Render("Thinking") + "\n\n" + content content = styles.NewStyle().Background(bg).Foreground(t.TextMuted()).Render("Thinking") + "\n\n" + content
@@ -333,7 +336,7 @@ func renderText(
timestamp = timestamp[12:] timestamp = timestamp[12:]
} }
// Check if this is an assistant message with mode (agent) information // Check if this is an assistant message with agent information
var modelAndAgentSuffix string var modelAndAgentSuffix string
if assistantMsg, ok := message.(opencode.AssistantMessage); ok && assistantMsg.Mode != "" { if assistantMsg, ok := message.(opencode.AssistantMessage); ok && assistantMsg.Mode != "" {
// Find the agent index by name to get the correct color // Find the agent index by name to get the correct color
@@ -349,17 +352,15 @@ func renderText(
agentColor := util.GetAgentColor(agentIndex) agentColor := util.GetAgentColor(agentIndex)
// Style the agent name with the same color as status bar // Style the agent name with the same color as status bar
agentName := strings.Title(assistantMsg.Mode) agentName := cases.Title(language.Und).String(assistantMsg.Mode)
styledAgentName := styles.NewStyle().Foreground(agentColor).Bold(true).Render(agentName) styledAgentName := styles.NewStyle().Foreground(agentColor).Render(agentName)
modelAndAgentSuffix = fmt.Sprintf(" | %s | %s", assistantMsg.ModelID, styledAgentName) modelAndAgentSuffix = fmt.Sprintf("%s %s", styledAgentName, assistantMsg.ModelID)
} }
var info string var info string
if modelAndAgentSuffix != "" { if modelAndAgentSuffix != "" {
// For assistant messages: "timestamp | modelID | agentName" info = fmt.Sprintf("%s (%s)", modelAndAgentSuffix, timestamp)
info = fmt.Sprintf("%s%s", timestamp, modelAndAgentSuffix)
} else { } else {
// For user messages: "author (timestamp)"
info = fmt.Sprintf("%s (%s)", author, timestamp) info = fmt.Sprintf("%s (%s)", author, timestamp)
} }
info = styles.NewStyle().Foreground(t.TextMuted()).Render(info) info = styles.NewStyle().Foreground(t.TextMuted()).Render(info)