diff --git a/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageBubble.kt b/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageBubble.kt index 38fafce..3359a57 100644 --- a/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageBubble.kt +++ b/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageBubble.kt @@ -52,19 +52,19 @@ fun MessageBubble(message: HistoryMessageDto) { .padding(horizontal = 14.dp), horizontalAlignment = if (isUser) Alignment.End else Alignment.Start, ) { - bubbles.forEachIndexed { index, bubble -> + // 来源角标放在消息组顶部,明确标注下面这一组气泡来自哪里 + if (source != null) { + Text( + text = source, + style = MiuixTheme.textStyles.footnote2, + color = MiuixTheme.colorScheme.onSurfaceVariantSummary, + modifier = Modifier.padding(start = 6.dp, end = 6.dp), + ) + } + bubbles.forEach { bubble -> AnnotationLine(bubble.head) if (bubble.body.isNotEmpty()) BubbleBody(bubble.body, isUser) AnnotationLine(bubble.tail) - // 来源角标只在最后一条气泡下方显示一次,避免多气泡消息重复刷屏 - if (index == bubbles.lastIndex && source != null) { - Text( - text = source, - style = MiuixTheme.textStyles.footnote2, - color = MiuixTheme.colorScheme.onSurfaceVariantSummary, - modifier = Modifier.padding(top = 3.dp, start = 6.dp, end = 6.dp), - ) - } } } } diff --git a/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageSource.kt b/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageSource.kt index 6a1c6fd..1a391e7 100644 --- a/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageSource.kt +++ b/app/src/main/kotlin/top/yeij/cyrene/ui/chat/MessageSource.kt @@ -23,6 +23,8 @@ fun messageSourceLabel(message: HistoryMessageDto): String? { val browser = deviceId.removePrefix("web:").substringBefore(':') return "来自 Web($browser)" } + // IM 端 deviceId 形如 <平台名>:<配置id>:,只取平台名做友好显示 + platformLabels[deviceId.substringBefore(':')]?.let { return "来自 $it" } return "来自 $deviceId" }