Refine transient chat message styling
This commit is contained in:
1 parent
cb357d9692
commit
f015717962
2 files changed
+7
-7
No files matched your search
@@ -326,9 +326,9 @@ private fun MessageBubble(
|
||||
val isAttachment = message.kind == MessageKind.Attachment
|
||||
val isSystemNotice = message.role == MessageRole.System && !isToolResult && !isTool && !isAttachment
|
||||
val bubbleColor = when {
|
||||
isSystemNotice -> MaterialTheme.colorScheme.surfaceContainerHigh
|
||||
isSystemNotice -> MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.6f)
|
||||
message.role == MessageRole.User -> MaterialTheme.colorScheme.primaryContainer
|
||||
isToolResult && message.status == "tool-error" -> MaterialTheme.colorScheme.errorContainer.copy(alpha = 0.36f)
|
||||
isToolResult && message.status == "tool-error" -> MaterialTheme.colorScheme.errorContainer.copy(alpha = 0.5f)
|
||||
isToolResult -> MaterialTheme.colorScheme.surfaceContainer
|
||||
isTool -> MaterialTheme.colorScheme.surfaceContainerLow
|
||||
isAttachment && message.status == "upload-failed" -> MaterialTheme.colorScheme.errorContainer.copy(alpha = 0.24f)
|
||||
@@ -393,7 +393,7 @@ private fun MessageBubble(
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(androidx.compose.foundation.shape.RoundedCornerShape(if (isSystemNotice) 14.dp else 18.dp))
|
||||
.clip(androidx.compose.foundation.shape.RoundedCornerShape(if (isSystemNotice) 12.dp else 18.dp))
|
||||
.border(
|
||||
width = when {
|
||||
isSystemNotice -> 0.dp
|
||||
@@ -411,12 +411,11 @@ private fun MessageBubble(
|
||||
shape = androidx.compose.foundation.shape.RoundedCornerShape(if (isSystemNotice) 14.dp else 18.dp),
|
||||
)
|
||||
.background(bubbleColor)
|
||||
.padding(if (isSystemNotice) 10.dp else 14.dp),
|
||||
.padding(if (isSystemNotice) 8.dp else 14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
when {
|
||||
isThinking -> {
|
||||
StatusPill(text = "思考中", tone = StatusPillTone.Warning)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
@@ -428,7 +427,7 @@ private fun MessageBubble(
|
||||
)
|
||||
Text(
|
||||
text = if (message.text.isBlank()) "正在思考…" else message.text,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
@@ -511,7 +510,7 @@ private fun MessageBubble(
|
||||
}
|
||||
isToolResult -> {
|
||||
StatusPill(
|
||||
text = if (message.status == "tool-error") "工具错误" else "工具结果",
|
||||
text = if (message.status == "tool-error") "执行失败" else "工具结果",
|
||||
tone = if (message.status == "tool-error") StatusPillTone.Error else StatusPillTone.Neutral,
|
||||
)
|
||||
if (!linkedToolName.isNullOrBlank()) {
|
||||
|
||||
Reference in new issue
Block a user