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
+1
View File
@@ -199,6 +199,7 @@ Android/iOS App
- [x] 已有保守版 queue drain:`openSession()` 会尝试继续发送当前会话的待发文本,`syncRemoteIfNeeded()` 会顺序尝试全局待发文本,失败即停
- [x] 聊天页已显式区分 queue drain 状态:队列自动处理中的文本会显示“队列发送中”
- [x] pending queue 已开始同时覆盖文本与附件:附件待上传项也会独立持久化,并在重新进入会话或手动同步时继续尝试上传
- [x] 附件上传状态已开始对齐队列语义:队列自动处理中的附件会显示“队列上传中”,与手动上传中的“上传中”分开
- [ ] 还没有完整的离线发送队列(当前已覆盖文本 + 附件,但还没有更完整的网络感知、后台 drain 与统一淘汰策略)
- [ ] 还没有真正基于网络恢复信号的自动补发