Keep cached session previews when available
This commit is contained in:
1 parent
9146b7a863
commit
32d10933ef
3 files changed
+25
-17
No files matched your search
+6
-3
@@ -458,7 +458,10 @@ class RemoteOpenClawRepository(
|
||||
}
|
||||
|
||||
suspend fun refreshSessions() {
|
||||
sessions = api.getSessions().map { dto -> dto.toDomain() }
|
||||
val existingPreviews = sessions.associateBy({ it.id }, { it.lastMessage })
|
||||
sessions = api.getSessions().map { dto ->
|
||||
dto.toDomain(existingLastMessage = existingPreviews[dto.id])
|
||||
}
|
||||
rebuildSessionSortKeysFromSessions(sessions)
|
||||
resortSessions(prioritizeId = recentSessionId)
|
||||
}
|
||||
@@ -1107,11 +1110,11 @@ class RemoteOpenClawRepository(
|
||||
)
|
||||
}
|
||||
|
||||
private fun SessionSummaryDto.toDomain(): SessionSummary {
|
||||
private fun SessionSummaryDto.toDomain(existingLastMessage: String? = null): SessionSummary {
|
||||
return SessionSummary(
|
||||
id = id,
|
||||
title = title,
|
||||
lastMessage = lastMessage ?: "",
|
||||
lastMessage = (lastMessage ?: existingLastMessage).orEmpty(),
|
||||
updatedAt = updatedAt,
|
||||
streamStatus = streamStatusStore[id],
|
||||
)
|
||||
|
||||
+18
-14
@@ -123,13 +123,15 @@ fun SessionListScreen(
|
||||
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Text("最近访问", style = MaterialTheme.typography.labelLarge)
|
||||
Text(recentSession.title, style = MaterialTheme.typography.titleMedium, maxLines = 1)
|
||||
Text(
|
||||
recentSession.lastMessage.ifBlank { "暂无摘要" },
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
recentSession.lastMessage.takeIf { it.isNotBlank() }?.let { summary ->
|
||||
Text(
|
||||
summary,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
}
|
||||
TextButton(onClick = { onOpenSession(recentSession.id) }) {
|
||||
Text("继续")
|
||||
@@ -218,13 +220,15 @@ private fun SessionRow(
|
||||
}
|
||||
}
|
||||
|
||||
Text(
|
||||
text = session.lastMessage.ifBlank { "暂无摘要" },
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
session.lastMessage.takeIf { it.isNotBlank() }?.let { summary ->
|
||||
Text(
|
||||
text = summary,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
||||
@@ -447,3 +447,4 @@ Android/iOS App
|
||||
- 2026-03-07:默认收起成功的工具调用噪音:聊天页时间线不再直接展示普通 `toolCall` 和成功 `toolResult`,优先保留用户/助手正文、附件与关键错误;工具失败仍继续显示,避免用户正常发一条消息却被一串内部工具事件刷屏。
|
||||
- 2026-03-07:首屏远程同步提速第一轮:App 端把 `status / agents / sessions` 从串行改成并行;BFF 端 `list_sessions()` 去掉每条 session 再补 `chat.history(limit=1)` 的 N+1 回查,首页先快速拿列表,避免刚打开就被会话摘要回查拖慢。
|
||||
- 2026-03-07:首屏远程同步提速第二轮:BFF 给 `/api/status`、`/api/agents`、`/api/sessions` 补了短 TTL 缓存,并让 `status` / `agents` 共享同一份 `openclaw status --json` 结果;热缓存下三个接口都压到了毫秒级,避免刚打开或短时间来回切页时反复打慢 CLI。
|
||||
- 2026-03-07:补一轮列表摘要降级策略:远端 session 列表不再回查摘要后,客户端刷新会优先沿用本地已有摘要;如果当前确实拿不到摘要,UI 直接留白而不是整屏显示“暂无摘要”,避免性能优化后的列表观感像异常状态。
|
||||
Reference in new issue
Block a user