Tone down system notices in chat timeline

This commit is contained in:
OpenClaw committed 2026-03-07 08:58:13 +08:00
1 parent ae0bf93ed1
commit e5e13a38f1
1 file changed
+25 -14
@@ -242,6 +242,7 @@ private fun MessageBubble(
val isThinking = message.status == "thinking" || message.kind == MessageKind.Thinking
val isTool = message.kind == MessageKind.Tool
val isToolResult = message.kind == MessageKind.ToolResult
val isSystemNotice = message.role == MessageRole.System && !isToolResult && !isTool
val bubbleColor = when {
isToolResult && message.status == "tool-error" -> MaterialTheme.colorScheme.errorContainer
isToolResult -> MaterialTheme.colorScheme.tertiaryContainer
@@ -280,30 +281,36 @@ private fun MessageBubble(
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = alignment) {
Column(
modifier = Modifier.fillMaxWidth(0.88f),
modifier = if (isSystemNotice) Modifier.fillMaxWidth() else Modifier.fillMaxWidth(0.88f),
verticalArrangement = Arrangement.spacedBy(6.dp),
horizontalAlignment = if (message.role == MessageRole.User) Alignment.End else Alignment.Start,
horizontalAlignment = if (isSystemNotice) Alignment.CenterHorizontally else if (message.role == MessageRole.User) Alignment.End else Alignment.Start,
) {
Text(
text = label,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
if (!isSystemNotice) {
Text(
text = label,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Column(
modifier = Modifier
.clip(androidx.compose.foundation.shape.RoundedCornerShape(20.dp))
.clip(androidx.compose.foundation.shape.RoundedCornerShape(if (isSystemNotice) 14.dp else 20.dp))
.border(
width = if (isTool || isToolResult) 1.dp else 0.dp,
width = when {
isSystemNotice -> 0.dp
isTool || isToolResult -> 1.dp
else -> 0.dp
},
color = when {
isToolResult && message.status == "tool-error" -> MaterialTheme.colorScheme.error
isToolResult -> MaterialTheme.colorScheme.tertiary
isTool -> MaterialTheme.colorScheme.secondary
else -> MaterialTheme.colorScheme.surfaceVariant
},
shape = androidx.compose.foundation.shape.RoundedCornerShape(20.dp),
shape = androidx.compose.foundation.shape.RoundedCornerShape(if (isSystemNotice) 14.dp else 20.dp),
)
.background(bubbleColor)
.padding(14.dp),
.background(if (isSystemNotice) MaterialTheme.colorScheme.surfaceContainerHigh else bubbleColor)
.padding(if (isSystemNotice) 10.dp else 14.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
when {
@@ -382,7 +389,11 @@ private fun MessageBubble(
}
}
else -> {
Text(text = displayText, style = MaterialTheme.typography.bodyLarge)
Text(
text = displayText,
style = if (isSystemNotice) MaterialTheme.typography.bodyMedium else MaterialTheme.typography.bodyLarge,
color = if (isSystemNotice) MaterialTheme.colorScheme.onSurfaceVariant else MaterialTheme.colorScheme.onSurface,
)
}
}
Row(
@@ -396,7 +407,7 @@ private fun MessageBubble(
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.weight(1f),
)
if (displayStatus != null) {
if (displayStatus != null && !isSystemNotice) {
StatusPill(text = displayStatus)
}
}