Style tool results as readable output blocks
This commit is contained in:
1 parent
b89eceef43
commit
7c3815f39a
1 file changed
+24
-9
@@ -333,15 +333,30 @@ private fun MessageBubble(
|
|||||||
},
|
},
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
)
|
)
|
||||||
Text(
|
Column(
|
||||||
text = toolResultText,
|
modifier = Modifier
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
.fillMaxWidth()
|
||||||
maxLines = if (expanded) Int.MAX_VALUE else 12,
|
.clip(androidx.compose.foundation.shape.RoundedCornerShape(12.dp))
|
||||||
overflow = TextOverflow.Ellipsis,
|
.background(
|
||||||
)
|
if (message.status == "tool-error") {
|
||||||
if (shouldCollapseToolResult) {
|
MaterialTheme.colorScheme.error.copy(alpha = 0.08f)
|
||||||
TextButton(onClick = { expanded = !expanded }) {
|
} else {
|
||||||
Text(if (expanded) "收起" 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 "展开完整结果")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user