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 = "系统正在尝试恢复发送这条消息…",
|
||||
|
||||
@@ -195,6 +195,7 @@ Android/iOS App
|
||||
- [x] 聊天页已显式区分“自动重试中”和普通手动发送中状态
|
||||
- [x] 已有第一版本地文本发送队列雏形:待发送文本会独立持久化,App 重启后可恢复并继续进入自动补发/手动重试链路
|
||||
- [x] 已有保守版 queue drain:`openSession()` 会尝试继续发送当前会话的待发文本,`syncRemoteIfNeeded()` 会顺序尝试全局待发文本,失败即停
|
||||
- [x] 聊天页已显式区分 queue drain 状态:队列自动处理中的文本会显示“队列发送中”
|
||||
- [ ] 还没有完整的离线发送队列(目前先覆盖文本,不含附件)
|
||||
- [ ] 还没有真正基于网络恢复信号的自动补发
|
||||
|
||||
@@ -400,6 +401,7 @@ Android/iOS App
|
||||
- 2026-03-07:继续统一 session 摘要选择逻辑:更多 preview 更新路径改为复用 `previewMessage()`,避免在 retry / snapshot merge / SSE completed / stream failed 等场景下直接拿 `lastOrNull()` 导致摘要被 thinking 占位或瞬时系统消息抢走。
|
||||
- 2026-03-07:开始补真正的本地发送队列雏形:新增独立的 `PendingSendQueue` 持久化结构,与 recent message cache 分离;文本待发送项现在会单独入队、在 hydrate 时恢复,并在发送成功/失败/重试后同步维护,减少“只有界面缓存、没有真实队列语义”的不一致。
|
||||
- 2026-03-07:补上第一版 queue drain:App 现在会在 `openSession()` 时尝试继续发送当前会话的待发文本,在 `syncRemoteIfNeeded()` 时顺序尝试全局待发文本;一旦某条失败就停止,避免激进乱冲。
|
||||
- 2026-03-07:补充 queue drain 的显式状态:被本地发送队列自动处理的文本消息现在会进入 `queue-draining` 状态,聊天页明确显示“队列发送中”,避免和手动发送/自动恢复重试混淆。
|
||||
- 2026-03-07:继续补 SSE 顺序一致性:当消息集合未变、只是顺序发生变化时,BFF / App 现已改为通过 `message.reordered` 精确纠正顺序,避免因为 diff 只看 id/内容变化而静默漏掉重排,也避免为单纯重排走整包 snapshot。
|
||||
- 2026-03-07:继续收缩 SSE 重刷范围:在消息通过 `message.removed` 逐条删空时,BFF 不再额外补发重复的空 `session.snapshot`,减少无意义整包刷新。
|
||||
- 2026-03-07:补强 BFF 会话摘要语义:session 列表里的 lastMessage 预览现在会按消息类型生成前缀与截断文案(附件/工具/工具结果/思考中/系统/断流),不再只是返回裸 `text`,让附件 overlay、工具消息和聊天页预览语义更一致。
|
||||
|
||||
Reference in new issue
Block a user