Unify session preview selection paths
This commit is contained in:
1 parent
8218207065
commit
42d5b97d69
2 files changed
+10
-9
No files matched your search
+8
-8
@@ -245,7 +245,7 @@ class RemoteOpenClawRepository(
|
||||
if (msg.id == messageId) msg.copy(status = "uploading", retryable = false) else msg
|
||||
}
|
||||
messageStore = messageStore + (sessionId to uploading)
|
||||
updateSessionPreview(sessionId, uploading.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(uploading))
|
||||
|
||||
runCatching {
|
||||
val remote = api.uploadAttachment(
|
||||
@@ -332,7 +332,7 @@ class RemoteOpenClawRepository(
|
||||
val localRetained = retainedLocalMessages(sessionId, remoteMessages)
|
||||
val merged = remoteMessages + localRetained
|
||||
messageStore = messageStore + (sessionId to merged)
|
||||
updateSessionPreview(sessionId, merged.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(merged))
|
||||
}
|
||||
|
||||
suspend fun retryAutoRecoverableMessages(sessionId: String): Boolean {
|
||||
@@ -384,7 +384,7 @@ class RemoteOpenClawRepository(
|
||||
)
|
||||
} else retried
|
||||
messageStore = messageStore + (sessionId to withThinking)
|
||||
updateSessionPreview(sessionId, withThinking.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(withThinking))
|
||||
|
||||
runCatching {
|
||||
api.sendMessage(sessionId, payload.text)
|
||||
@@ -410,7 +410,7 @@ class RemoteOpenClawRepository(
|
||||
val remoteMessages = event.payload.messages.map { it.toDomainMessage() }
|
||||
val merged = mergeSnapshotWithLocalPending(remoteMessages, localPending)
|
||||
messageStore = messageStore + (sessionId to merged)
|
||||
updateSessionPreview(sessionId, merged.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(merged))
|
||||
}
|
||||
|
||||
is SessionStreamEvent.Started -> {
|
||||
@@ -459,7 +459,7 @@ class RemoteOpenClawRepository(
|
||||
toolCallId = dto.toolCallId,
|
||||
)
|
||||
messageStore = messageStore + (sessionId to next)
|
||||
updateSessionPreview(sessionId, next.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(next))
|
||||
}
|
||||
|
||||
is SessionStreamEvent.Completed -> {
|
||||
@@ -473,7 +473,7 @@ class RemoteOpenClawRepository(
|
||||
currentMessages + completed
|
||||
}
|
||||
messageStore = messageStore + (sessionId to next)
|
||||
updateSessionPreview(sessionId, next.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(next))
|
||||
}
|
||||
|
||||
is SessionStreamEvent.Removed -> {
|
||||
@@ -509,7 +509,7 @@ class RemoteOpenClawRepository(
|
||||
kind = MessageKind.Text,
|
||||
))
|
||||
)
|
||||
updateSessionPreview(sessionId, messageStore[sessionId]?.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(messageStore[sessionId].orEmpty()))
|
||||
return@collect
|
||||
}
|
||||
streamStatusStore = streamStatusStore + (sessionId to "reconnecting")
|
||||
@@ -578,7 +578,7 @@ class RemoteOpenClawRepository(
|
||||
}
|
||||
}
|
||||
messageStore = messageStore + (sessionId to next)
|
||||
updateSessionPreview(sessionId, next.lastOrNull())
|
||||
updateSessionPreview(sessionId, previewMessage(next))
|
||||
}
|
||||
|
||||
private fun restoreCachedMessage(sessionId: String, cached: MessageCacheItem): ChatMessage {
|
||||
|
||||
Reference in new issue
Block a user