From c7ed16776072d20158cc13aacc308289aedb65b8 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sat, 7 Mar 2026 08:51:29 +0800 Subject: [PATCH] Tune structured tool output presentation --- .../cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt index 0e309f7..87c2257 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt @@ -250,6 +250,7 @@ private fun MessageBubble( } val displayText = message.text.take(visibleChars) + val isStructuredOutput = isToolResult && looksStructuredOutput(displayText) val shouldCollapseToolResult = isToolResult && displayText.length > 240 val toolResultText = if (shouldCollapseToolResult && !expanded) displayText.take(240).trimEnd() + "…" else displayText val displayStatus = when { @@ -349,7 +350,11 @@ private fun MessageBubble( ) { Text( text = toolResultText, - style = MaterialTheme.typography.bodyMedium, + style = if (isStructuredOutput) { + MaterialTheme.typography.bodySmall + } else { + MaterialTheme.typography.bodyMedium + }, maxLines = if (expanded) Int.MAX_VALUE else 12, overflow = TextOverflow.Ellipsis, )