Align attachment queue drain states

This commit is contained in:
OpenClaw committed 2026-03-07 12:57:53 +08:00
1 parent 527fac9025
commit b3f009d644
3 files changed
+22 -2

No files matched your search

@@ -277,7 +277,7 @@ class RemoteOpenClawRepository(
role = MessageRole.User,
text = fileName,
createdAt = "现在",
status = "uploading",
status = "queue-draining",
kind = MessageKind.Attachment,
contentType = contentType,
sizeBytes = bytes.size,
@@ -330,8 +330,13 @@ class RemoteOpenClawRepository(
override suspend fun retryAttachment(sessionId: String, messageId: String) {
val payload = attachmentRetryStore[messageId] ?: return
val current = messageStore[sessionId].orEmpty()
val isQueueDrain = messageId in pendingAttachmentQueue
val uploading = current.map { msg ->
if (msg.id == messageId) msg.copy(status = "uploading", retryable = false) else msg
if (msg.id == messageId) msg.copy(
status = if (isQueueDrain) "queue-draining" else "uploading",
retryable = false,
createdAt = "现在",
) else msg
}
messageStore = messageStore + (sessionId to uploading)
updateSessionPreview(sessionId, previewMessage(uploading))
@@ -327,6 +327,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.kind == MessageKind.Attachment && message.status == "queue-draining" -> "队列上传中"
message.status == "queue-draining" -> "队列发送中"
message.status == "retrying-auto" -> "自动重试中"
message.status == "queued" -> "发送中"
@@ -432,6 +433,19 @@ private fun MessageBubble(
}
}
}
if (message.status == "queue-draining") {
Text(
text = "系统正在按本地待发队列继续上传这个附件…",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
} else if (message.status == "uploading") {
Text(
text = "正在手动发起附件上传…",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
if (attachmentDetailsExpanded) {
Column(
modifier = Modifier