Tune structured tool output presentation
This commit is contained in:
1 parent
7c3815f39a
commit
c7ed167760
1 file changed
+6
-1
@@ -250,6 +250,7 @@ private fun MessageBubble(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val displayText = message.text.take(visibleChars)
|
val displayText = message.text.take(visibleChars)
|
||||||
|
val isStructuredOutput = isToolResult && looksStructuredOutput(displayText)
|
||||||
val shouldCollapseToolResult = isToolResult && displayText.length > 240
|
val shouldCollapseToolResult = isToolResult && displayText.length > 240
|
||||||
val toolResultText = if (shouldCollapseToolResult && !expanded) displayText.take(240).trimEnd() + "…" else displayText
|
val toolResultText = if (shouldCollapseToolResult && !expanded) displayText.take(240).trimEnd() + "…" else displayText
|
||||||
val displayStatus = when {
|
val displayStatus = when {
|
||||||
@@ -349,7 +350,11 @@ private fun MessageBubble(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = toolResultText,
|
text = toolResultText,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = if (isStructuredOutput) {
|
||||||
|
MaterialTheme.typography.bodySmall
|
||||||
|
} else {
|
||||||
|
MaterialTheme.typography.bodyMedium
|
||||||
|
},
|
||||||
maxLines = if (expanded) Int.MAX_VALUE else 12,
|
maxLines = if (expanded) Int.MAX_VALUE else 12,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user