Add attachment card actions and details panel
This commit is contained in:
1 parent
2b21e56413
commit
1abb1961b8
3 files changed
+38
-8
No files matched your search
@@ -207,6 +207,9 @@ private fun OpenClawRoot(appState: OpenClawAppState) {
|
||||
appState.retryMessage(activeSession.id, messageId)
|
||||
}
|
||||
},
|
||||
onCopyAttachmentName = { fileName ->
|
||||
appState.feedbackMessage = "已复制文件名:$fileName"
|
||||
},
|
||||
)
|
||||
|
||||
appState.selectedTab == MainTab.Sessions -> SessionListScreen(
|
||||
|
||||
@@ -55,6 +55,7 @@ fun ChatScreen(
|
||||
onSendAttachmentStub: () -> Unit,
|
||||
onRetryAttachment: (String) -> Unit,
|
||||
onRetryMessage: (String) -> Unit,
|
||||
onCopyAttachmentName: (String) -> Unit,
|
||||
) {
|
||||
var input by remember { mutableStateOf("") }
|
||||
val listState = rememberLazyListState()
|
||||
@@ -181,6 +182,7 @@ fun ChatScreen(
|
||||
linkedToolName = linkedTool?.toolName,
|
||||
onRetryAttachment = onRetryAttachment,
|
||||
onRetryMessage = onRetryMessage,
|
||||
onCopyAttachmentName = onCopyAttachmentName,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -241,6 +243,7 @@ private fun MessageBubble(
|
||||
linkedToolName: String? = null,
|
||||
onRetryAttachment: (String) -> Unit,
|
||||
onRetryMessage: (String) -> Unit,
|
||||
onCopyAttachmentName: (String) -> Unit,
|
||||
) {
|
||||
val alignment = when (message.role) {
|
||||
MessageRole.User -> Alignment.CenterEnd
|
||||
@@ -268,6 +271,7 @@ private fun MessageBubble(
|
||||
}
|
||||
var visibleChars by remember(message.id) { mutableIntStateOf(if (animateText) 0 else message.text.length) }
|
||||
var expanded by remember(message.id) { mutableStateOf(false) }
|
||||
var attachmentDetailsExpanded by remember(message.id) { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(message.id, animateText) {
|
||||
if (animateText) {
|
||||
@@ -371,9 +375,32 @@ private fun MessageBubble(
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
if (message.retryable && message.status == "upload-failed") {
|
||||
TextButton(onClick = { onRetryAttachment(message.id) }) {
|
||||
Text("重试上传")
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
TextButton(onClick = { onCopyAttachmentName(message.text) }) {
|
||||
Text("复制文件名")
|
||||
}
|
||||
TextButton(onClick = { attachmentDetailsExpanded = !attachmentDetailsExpanded }) {
|
||||
Text(if (attachmentDetailsExpanded) "收起详情" else "查看详情")
|
||||
}
|
||||
if (message.retryable && message.status == "upload-failed") {
|
||||
TextButton(onClick = { onRetryAttachment(message.id) }) {
|
||||
Text("重试上传")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attachmentDetailsExpanded) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(androidx.compose.foundation.shape.RoundedCornerShape(12.dp))
|
||||
.background(MaterialTheme.colorScheme.surface.copy(alpha = 0.4f))
|
||||
.padding(10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
Text("文件名:${message.text}", style = MaterialTheme.typography.bodySmall)
|
||||
Text("类型:${message.contentType ?: "unknown"}", style = MaterialTheme.typography.bodySmall)
|
||||
Text("大小:${message.sizeBytes?.let(::formatBytes) ?: "unknown"}", style = MaterialTheme.typography.bodySmall)
|
||||
Text("状态:${displayStatus ?: "unknown"}", style = MaterialTheme.typography.bodySmall)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,12 +189,12 @@ Android/iOS App
|
||||
|
||||
### 4.3 附件交互动作
|
||||
|
||||
目前还没有:
|
||||
目前:
|
||||
|
||||
- 点击附件打开
|
||||
- 下载附件
|
||||
- 复制文件名
|
||||
- 查看附件详情
|
||||
- [x] 复制文件名
|
||||
- [x] 查看附件详情
|
||||
- [ ] 点击附件打开
|
||||
- [ ] 下载附件
|
||||
|
||||
### 4.4 iOS / Web 文件选择器
|
||||
|
||||
|
||||
Reference in new issue
Block a user