diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt index 1399c8c..9e60d26 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/data/RemoteOpenClawRepository.kt @@ -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], ) diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt index ac1e52e..7a0e3d8 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt @@ -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(), diff --git a/docs/MVP_PROGRESS.md b/docs/MVP_PROGRESS.md index e9b81c9..ad033f7 100644 --- a/docs/MVP_PROGRESS.md +++ b/docs/MVP_PROGRESS.md @@ -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 直接留白而不是整屏显示“暂无摘要”,避免性能优化后的列表观感像异常状态。