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,
|
width int,
|
||||||
extra string,
|
extra string,
|
||||||
isThinking bool,
|
isThinking bool,
|
||||||
|
isQueued bool,
|
||||||
fileParts []opencode.FilePart,
|
fileParts []opencode.FilePart,
|
||||||
agentParts []opencode.AgentPart,
|
agentParts []opencode.AgentPart,
|
||||||
toolCalls ...opencode.ToolPart,
|
toolCalls ...opencode.ToolPart,
|
||||||
@@ -331,6 +332,10 @@ func renderText(
|
|||||||
wrappedText := ansi.WordwrapWc(styledText, width-6, " ")
|
wrappedText := ansi.WordwrapWc(styledText, width-6, " ")
|
||||||
wrappedText = strings.ReplaceAll(wrappedText, "\u2011", "-")
|
wrappedText = strings.ReplaceAll(wrappedText, "\u2011", "-")
|
||||||
content = base.Width(width - 6).Render(wrappedText)
|
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.
|
timestamp := ts.
|
||||||
@@ -400,12 +405,16 @@ func renderText(
|
|||||||
|
|
||||||
switch message.(type) {
|
switch message.(type) {
|
||||||
case opencode.UserMessage:
|
case opencode.UserMessage:
|
||||||
|
borderColor := t.Secondary()
|
||||||
|
if isQueued {
|
||||||
|
borderColor = t.Accent()
|
||||||
|
}
|
||||||
return renderContentBlock(
|
return renderContentBlock(
|
||||||
app,
|
app,
|
||||||
content,
|
content,
|
||||||
width,
|
width,
|
||||||
WithTextColor(t.Text()),
|
WithTextColor(t.Text()),
|
||||||
WithBorderColor(t.Secondary()),
|
WithBorderColor(borderColor),
|
||||||
)
|
)
|
||||||
case opencode.AssistantMessage:
|
case opencode.AssistantMessage:
|
||||||
if isThinking {
|
if isThinking {
|
||||||
|
|||||||
@@ -373,10 +373,8 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
)
|
)
|
||||||
|
|
||||||
author := m.app.Config.Username
|
author := m.app.Config.Username
|
||||||
if casted.ID > lastAssistantMessage {
|
isQueued := casted.ID > lastAssistantMessage
|
||||||
author += " [queued]"
|
key := m.cache.GenerateKey(casted.ID, part.Text, width, files, author, isQueued)
|
||||||
}
|
|
||||||
key := m.cache.GenerateKey(casted.ID, part.Text, width, files, author)
|
|
||||||
content, cached = m.cache.Get(key)
|
content, cached = m.cache.Get(key)
|
||||||
if !cached {
|
if !cached {
|
||||||
content = renderText(
|
content = renderText(
|
||||||
@@ -388,6 +386,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
width,
|
width,
|
||||||
files,
|
files,
|
||||||
false,
|
false,
|
||||||
|
isQueued,
|
||||||
fileParts,
|
fileParts,
|
||||||
agentParts,
|
agentParts,
|
||||||
)
|
)
|
||||||
@@ -463,6 +462,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
width,
|
width,
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
[]opencode.FilePart{},
|
[]opencode.FilePart{},
|
||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
toolCallParts...,
|
toolCallParts...,
|
||||||
@@ -479,6 +479,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
width,
|
width,
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
[]opencode.FilePart{},
|
[]opencode.FilePart{},
|
||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
toolCallParts...,
|
toolCallParts...,
|
||||||
@@ -558,6 +559,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
width,
|
width,
|
||||||
"",
|
"",
|
||||||
true,
|
true,
|
||||||
|
false,
|
||||||
[]opencode.FilePart{},
|
[]opencode.FilePart{},
|
||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
)
|
)
|
||||||
@@ -591,6 +593,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
width,
|
width,
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
[]opencode.FilePart{},
|
[]opencode.FilePart{},
|
||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user