Show auto retry state in chat UI
This commit is contained in:
1 parent
8762e2c805
commit
595c0edb3b
3 files changed
+16
-1
No files matched your search
+6
-1
@@ -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-") }) {
|
||||
|
||||
@@ -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("重试发送")
|
||||
|
||||
@@ -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:聊天页补充自动恢复状态文案:自动补发中的文本消息会明确显示“自动重试中”,避免和普通发送中的状态混淆。
|
||||
Reference in new issue
Block a user