Style tool results as readable output blocks

This commit is contained in:
OpenClaw committed 2026-03-07 08:50:16 +08:00
1 parent b89eceef43
commit 7c3815f39a
1 file changed
+24 -9
@@ -333,15 +333,30 @@ private fun MessageBubble(
},
style = MaterialTheme.typography.titleSmall,
)
Text(
text = toolResultText,
style = MaterialTheme.typography.bodyMedium,
maxLines = if (expanded) Int.MAX_VALUE else 12,
overflow = TextOverflow.Ellipsis,
)
if (shouldCollapseToolResult) {
TextButton(onClick = { expanded = !expanded }) {
Text(if (expanded) "收起" else "展开完整结果")
Column(
modifier = Modifier
.fillMaxWidth()
.clip(androidx.compose.foundation.shape.RoundedCornerShape(12.dp))
.background(
if (message.status == "tool-error") {
MaterialTheme.colorScheme.error.copy(alpha = 0.08f)
} else {
MaterialTheme.colorScheme.surface.copy(alpha = 0.45f)
}
)
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = toolResultText,
style = MaterialTheme.typography.bodyMedium,
maxLines = if (expanded) Int.MAX_VALUE else 12,
overflow = TextOverflow.Ellipsis,
)
if (shouldCollapseToolResult) {
TextButton(onClick = { expanded = !expanded }) {
Text(if (expanded) "收起" else "展开完整结果")
}
}
}
}