Show queue drain state in chat UI
This commit is contained in:
1 parent
e31b164e30
commit
11cd2d5b56
3 files changed
+20
-2
No files matched your search
+10
-2
@@ -411,12 +411,20 @@ class RemoteOpenClawRepository(
|
||||
}
|
||||
|
||||
override suspend fun retryMessage(sessionId: String, messageId: String) {
|
||||
retryMessageInternal(sessionId, messageId, fromQueueDrain = false)
|
||||
}
|
||||
|
||||
private suspend fun retryMessageInternal(sessionId: String, messageId: String, fromQueueDrain: Boolean) {
|
||||
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 = if (isAutoRetry) "retrying-auto" else "queued",
|
||||
status = when {
|
||||
fromQueueDrain -> "queue-draining"
|
||||
isAutoRetry -> "retrying-auto"
|
||||
else -> "queued"
|
||||
},
|
||||
retryable = false,
|
||||
createdAt = "现在",
|
||||
) else msg
|
||||
@@ -455,7 +463,7 @@ class RemoteOpenClawRepository(
|
||||
val payload = pendingTextQueue[messageId] ?: continue
|
||||
drained = true
|
||||
runCatching {
|
||||
retryMessage(payload.sessionId, messageId)
|
||||
retryMessageInternal(payload.sessionId, messageId, fromQueueDrain = true)
|
||||
}.onFailure {
|
||||
return drained
|
||||
}
|
||||
|
||||
@@ -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 == "queue-draining" -> "队列发送中"
|
||||
message.status == "retrying-auto" -> "自动重试中"
|
||||
message.status == "queued" -> "发送中"
|
||||
message.status == "send-failed" -> "发送失败"
|
||||
@@ -495,6 +496,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 == "queue-draining") {
|
||||
Text(
|
||||
text = "系统正在按本地待发队列继续发送这条消息…",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
if (message.status == "retrying-auto") {
|
||||
Text(
|
||||
text = "系统正在尝试恢复发送这条消息…",
|
||||
|
||||
Reference in new issue
Block a user