mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-23 18:54:21 +01:00
feat: better queued visual
This commit is contained in:
@@ -211,6 +211,7 @@ func renderText(
|
||||
width int,
|
||||
extra string,
|
||||
isThinking bool,
|
||||
isQueued bool,
|
||||
fileParts []opencode.FilePart,
|
||||
agentParts []opencode.AgentPart,
|
||||
toolCalls ...opencode.ToolPart,
|
||||
@@ -331,6 +332,10 @@ func renderText(
|
||||
wrappedText := ansi.WordwrapWc(styledText, width-6, " ")
|
||||
wrappedText = strings.ReplaceAll(wrappedText, "\u2011", "-")
|
||||
content = base.Width(width - 6).Render(wrappedText)
|
||||
if isQueued {
|
||||
queuedStyle := styles.NewStyle().Background(t.Accent()).Foreground(t.BackgroundPanel()).Bold(true).Padding(0, 1)
|
||||
content = queuedStyle.Render("QUEUED") + "\n\n" + content
|
||||
}
|
||||
}
|
||||
|
||||
timestamp := ts.
|
||||
@@ -400,12 +405,16 @@ func renderText(
|
||||
|
||||
switch message.(type) {
|
||||
case opencode.UserMessage:
|
||||
borderColor := t.Secondary()
|
||||
if isQueued {
|
||||
borderColor = t.Accent()
|
||||
}
|
||||
return renderContentBlock(
|
||||
app,
|
||||
content,
|
||||
width,
|
||||
WithTextColor(t.Text()),
|
||||
WithBorderColor(t.Secondary()),
|
||||
WithBorderColor(borderColor),
|
||||
)
|
||||
case opencode.AssistantMessage:
|
||||
if isThinking {
|
||||
|
||||
@@ -373,10 +373,8 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
||||
)
|
||||
|
||||
author := m.app.Config.Username
|
||||
if casted.ID > lastAssistantMessage {
|
||||
author += " [queued]"
|
||||
}
|
||||
key := m.cache.GenerateKey(casted.ID, part.Text, width, files, author)
|
||||
isQueued := casted.ID > lastAssistantMessage
|
||||
key := m.cache.GenerateKey(casted.ID, part.Text, width, files, author, isQueued)
|
||||
content, cached = m.cache.Get(key)
|
||||
if !cached {
|
||||
content = renderText(
|
||||
@@ -388,6 +386,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
||||
width,
|
||||
files,
|
||||
false,
|
||||
isQueued,
|
||||
fileParts,
|
||||
agentParts,
|
||||
)
|
||||
@@ -463,6 +462,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
||||
width,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
[]opencode.FilePart{},
|
||||
[]opencode.AgentPart{},
|
||||
toolCallParts...,
|
||||
@@ -479,6 +479,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
||||
width,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
[]opencode.FilePart{},
|
||||
[]opencode.AgentPart{},
|
||||
toolCallParts...,
|
||||
@@ -558,6 +559,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
||||
width,
|
||||
"",
|
||||
true,
|
||||
false,
|
||||
[]opencode.FilePart{},
|
||||
[]opencode.AgentPart{},
|
||||
)
|
||||
@@ -591,6 +593,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
||||
width,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
[]opencode.FilePart{},
|
||||
[]opencode.AgentPart{},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user