diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt index 5a50a81..c2539df 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt @@ -362,8 +362,13 @@ class RemoteOpenClawRepository( override suspend fun retryMessage(sessionId: String, messageId: String) { val payload = textRetryStore[messageId] ?: return val current = messageStore[sessionId].orEmpty() + val isAutoRetry = messageId in autoRetryMessageIds val retried = current.map { msg -> - if (msg.id == messageId) msg.copy(status = "queued", retryable = false, createdAt = "现在") else msg + if (msg.id == messageId) msg.copy( + status = if (isAutoRetry) "retrying-auto" else "queued", + retryable = false, + createdAt = "现在", + ) else msg } autoRetryMessageIds.remove(messageId) val withThinking = if (retried.none { it.id.startsWith("local-thinking-") }) { 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 a6f5890..4f11fb0 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 @@ -312,6 +312,7 @@ private fun MessageBubble( val toolResultText = if (shouldCollapseToolResult && !expanded) displayText.take(240).trimEnd() + "…" else displayText val displayStatus = when { animateText && visibleChars < message.text.length -> "streaming" + message.status == "retrying-auto" -> "自动重试中" message.status == "queued" -> "发送中" message.status == "send-failed" -> "发送失败" message.status == "uploading" -> "上传中" @@ -494,6 +495,13 @@ private fun MessageBubble( style = if (isSystemNotice) MaterialTheme.typography.bodyMedium else MaterialTheme.typography.bodyLarge, color = if (isSystemNotice) MaterialTheme.colorScheme.onSurfaceVariant else MaterialTheme.colorScheme.onSurface, ) + if (message.status == "retrying-auto") { + Text( + text = "系统正在尝试恢复发送这条消息…", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } if (message.retryable && message.status == "send-failed") { TextButton(onClick = { onRetryMessage(message.id) }) { Text("重试发送") diff --git a/docs/MVP_PROGRESS.md b/docs/MVP_PROGRESS.md index 9d0adb7..ffeed68 100644 --- a/docs/MVP_PROGRESS.md +++ b/docs/MVP_PROGRESS.md @@ -185,6 +185,7 @@ Android/iOS App - [x] App 重启后,缓存里的 `uploading` 附件会恢复成明确失败态,避免假性卡死 - [x] 手动刷新/重新进入会话时,会保留本地尚未被远端确认的失败消息,避免刷新后直接消失 - [x] 从缓存恢复出来的 `queued` 文本,在重新进入会话时会自动尝试补发一次 +- [x] 聊天页已显式区分“自动重试中”和普通手动发送中状态 - [ ] 还没有离线发送队列 - [ ] 还没有真正基于网络恢复信号的自动补发 @@ -376,3 +377,4 @@ Android/iOS App - 2026-03-07:补强发送失败状态缓存:发送/重试消息、上传/重试附件后会及时刷新最近消息缓存;App 重启后,缓存中的 `queued` 文本会转成可重试失败态,缓存中的 `uploading` 附件会转成明确失败态,避免 UI 长时间停留在假性发送中。 - 2026-03-07:补强消息刷新合并逻辑:手动刷新或重新进入会话时,若某条本地失败消息尚未被远端 history 确认,不会被 `refreshMessages()` 直接覆盖掉,而是继续保留在时间线里供用户重试。 - 2026-03-07:新增第一版自动恢复补发:仅针对“从缓存恢复出来、原本处于 `queued` 的文本消息”,在重新进入会话时自动尝试补发一次;若仍失败,则继续保留为可手动重试状态。 +- 2026-03-07:聊天页补充自动恢复状态文案:自动补发中的文本消息会明确显示“自动重试中”,避免和普通发送中的状态混淆。