Unify cache recovery with local message phases
This commit is contained in:
1 parent
a6119aeb46
commit
85b974b900
3 files changed
+21
-3
No files matched your search
@@ -75,3 +75,7 @@ fun ChatMessage.isLocalPendingActive(): Boolean {
|
||||
LocalMessagePhase.ManualProcessing,
|
||||
)
|
||||
}
|
||||
|
||||
fun ChatMessage.isLocalFailure(): Boolean {
|
||||
return localMessagePhase() == LocalMessagePhase.Failed
|
||||
}
|
||||
+16
-3
@@ -3,6 +3,7 @@ package cn.xiaobai.openclawapp.data
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import cn.xiaobai.openclawapp.data.isLocalFailure
|
||||
import cn.xiaobai.openclawapp.data.isLocalPendingActive
|
||||
import cn.xiaobai.openclawapp.network.MobileGatewayApi
|
||||
import cn.xiaobai.openclawapp.network.SessionSummaryDto
|
||||
@@ -834,7 +835,19 @@ class RemoteOpenClawRepository(
|
||||
autoRetryMessageIds.add(domain.id)
|
||||
domain.copy(status = "send-failed", retryable = true)
|
||||
}
|
||||
domain.role == MessageRole.User && domain.kind == MessageKind.Text && domain.status == "send-failed" -> {
|
||||
domain.role == MessageRole.User && domain.kind == MessageKind.Text && domain.isLocalPendingActive() -> {
|
||||
textRetryStore[domain.id] = TextRetryPayload(sessionId, domain.text)
|
||||
pendingTextQueue[domain.id] = PendingTextSend(
|
||||
messageId = domain.id,
|
||||
sessionId = sessionId,
|
||||
text = domain.text,
|
||||
createdAt = domain.createdAt,
|
||||
autoRetryEligible = false,
|
||||
)
|
||||
autoRetryMessageIds.remove(domain.id)
|
||||
domain.copy(status = "send-failed", retryable = true)
|
||||
}
|
||||
domain.role == MessageRole.User && domain.kind == MessageKind.Text && domain.isLocalFailure() -> {
|
||||
textRetryStore[domain.id] = TextRetryPayload(sessionId, domain.text)
|
||||
pendingTextQueue[domain.id] = PendingTextSend(
|
||||
messageId = domain.id,
|
||||
@@ -846,7 +859,7 @@ class RemoteOpenClawRepository(
|
||||
autoRetryMessageIds.remove(domain.id)
|
||||
domain.copy(retryable = true)
|
||||
}
|
||||
domain.kind == MessageKind.Attachment && (domain.status == "uploading" || domain.status == "queue-draining" || domain.status == "upload-failed") -> {
|
||||
domain.kind == MessageKind.Attachment && (domain.isLocalPendingActive() || domain.isLocalFailure()) -> {
|
||||
domain.copy(
|
||||
status = "upload-failed",
|
||||
retryable = attachmentRetryStore.containsKey(domain.id) || pendingAttachmentQueue.containsKey(domain.id),
|
||||
@@ -914,7 +927,7 @@ class RemoteOpenClawRepository(
|
||||
addAll(pendingThinking)
|
||||
}
|
||||
}.onEach { msg ->
|
||||
if (!msg.id.startsWith("local-") && msg.role == MessageRole.User && msg.status != "send-failed") {
|
||||
if (!msg.id.startsWith("local-") && msg.role == MessageRole.User && !msg.isLocalFailure()) {
|
||||
textRetryStore.remove(msg.id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user