mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-07 09:54:56 +01:00
fix: reformat assistant message footer
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user