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("重试发送")
|
||||
|
||||
Reference in new issue
Block a user