From 6557756e7ac745ec93a7e3fb9c3ba7a97b956592 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sat, 7 Mar 2026 20:14:27 +0800 Subject: [PATCH] Tighten chat chrome and composer --- .../kotlin/cn/xiaobai/openclawapp/App.kt | 24 ++++----- .../openclawapp/feature/chat/ChatScreen.kt | 53 ++++++++----------- docs/MVP_PROGRESS.md | 1 + 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt index 76be310..6eaa667 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Button import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold @@ -143,18 +144,21 @@ private fun OpenClawRoot(appState: OpenClawAppState) { is AppRoute.Chat -> { CenterAlignedTopAppBar( title = { - Text(activeSession?.title ?: "会话") + Text( + text = activeSession?.title ?: "会话", + style = androidx.compose.material3.MaterialTheme.typography.titleMedium, + ) }, navigationIcon = { - TextButton(onClick = appState::closeChat) { + Button(onClick = appState::closeChat) { Text("返回") } }, actions = { - TextButton(onClick = { pickAttachment() }) { + Button(onClick = { pickAttachment() }) { Text("附件") } - TextButton(onClick = { + Button(onClick = { activeSession?.id?.let { sessionId -> coroutineScope.launch { appState.clearSyncError() @@ -168,17 +172,7 @@ private fun OpenClawRoot(appState: OpenClawAppState) { ) } - AppRoute.Sessions -> { - CenterAlignedTopAppBar(title = { Text("会话") }) - } - - AppRoute.Status -> { - CenterAlignedTopAppBar(title = { Text("状态") }) - } - - AppRoute.Settings -> { - CenterAlignedTopAppBar(title = { Text("设置") }) - } + else -> Unit } }, bottomBar = { diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt index ee74ba6..518c7f5 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/chat/ChatScreen.kt @@ -144,42 +144,33 @@ fun ChatScreen( } Card(modifier = Modifier.fillMaxWidth()) { - Column( + Row( modifier = Modifier .fillMaxWidth() - .padding(12.dp), - verticalArrangement = Arrangement.spacedBy(10.dp), + .padding(horizontal = 10.dp, vertical = 10.dp), + horizontalArrangement = Arrangement.spacedBy(10.dp), + verticalAlignment = Alignment.Bottom, ) { - Text( - if (isSending) "正在发送消息…" else "继续当前会话", - style = MaterialTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant, + OutlinedTextField( + value = input, + onValueChange = { input = it }, + modifier = Modifier.weight(1f), + label = { Text("输入消息") }, + placeholder = { Text("给 $sessionTitle 发一句话") }, + maxLines = 3, + enabled = !isSending, ) - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(12.dp), - verticalAlignment = Alignment.Bottom, + Button( + onClick = { + if (input.isNotBlank() && !isSending) { + onSend(input.trim()) + input = "" + } + }, + enabled = !isSending, ) { - OutlinedTextField( - value = input, - onValueChange = { input = it }, - modifier = Modifier.weight(1f), - label = { Text("输入消息") }, - placeholder = { Text("给 $sessionTitle 发一句话") }, - maxLines = 4, - enabled = !isSending, - ) - Button( - onClick = { - if (input.isNotBlank() && !isSending) { - onSend(input.trim()) - input = "" - } - }, - enabled = !isSending, - ) { - if (isSending) CircularProgressIndicator() else Text("发送") - } + if (isSending) CircularProgressIndicator() else Text("发送") + } } } } diff --git a/docs/MVP_PROGRESS.md b/docs/MVP_PROGRESS.md index ad033f7..bffa317 100644 --- a/docs/MVP_PROGRESS.md +++ b/docs/MVP_PROGRESS.md @@ -448,3 +448,4 @@ Android/iOS App - 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 直接留白而不是整屏显示“暂无摘要”,避免性能优化后的列表观感像异常状态。 +- 2026-03-07:按最新交互反馈继续收聊天页壳层:非会话页移除 TopAppBar,只在会话详情保留顶部导航;会话页顶栏返回/附件/刷新改成更明确的按钮,标题字号再收小;输入栏去掉“继续当前会话”说明并压缩整体高度,减少底部控件占屏。