Make messages collapsible (useful for long messages) #146
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#146
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Feature Description
Add a collapse/expand toggle to message items to hide/show long message content. Long messages (>500 characters) start collapsed when loading a session, but new messages during the session always start expanded. Show truncated preview when collapsed.
Implementation Plan (Updated)
Key Change: Using
rememberSaveablefor state management instead of ViewModel to simplify implementation.Steps
collapsedMessageIdsstate inMessageList.ktusingrememberSaveable { mutableStateOf<Set<Long>>(emptySet()) }LaunchedEffect(chatSession.id)inMessageList.ktto initializecollapsedMessageIdswith message IDs wherecontent.length > 500when session changesMessageList.kt:onToggleCollapse = { id -> collapsedMessageIds = if (id in collapsedMessageIds) collapsedMessageIds - id else collapsedMessageIds + id }isCollapsed = message.id in collapsedMessageIds,isCollapsible, andonToggleCollapsetoMessageItem.ktIconButtonwithExpandLess/ExpandMoreicons inMessageItem.ktheader row next to display name, only visible whenmessage.content.length > 500MessageContent.ktto acceptisCollapsedandonToggleCollapseparameters, display truncated text (first 200 characters + "...") when collapsed, wrap inAnimatedVisibilitywithexpandVertically/shrinkVerticallyRequirements
AnimatedVisibilitywithexpandVertically/shrinkVerticallyrememberSaveablebut resets when navigating to different sessionFiles Modified
app/src/commonMain/kotlin/eu/torvian/chatbot/app/compose/chatarea/MessageList.kt(added state, initialization, and toggle logic)app/src/commonMain/kotlin/eu/torvian/chatbot/app/compose/chatarea/MessageItem.kt(added collapse button and pass props)app/src/commonMain/kotlin/eu/torvian/chatbot/app/compose/chatarea/MessageContent.kt(implemented collapsed view with animation)Implementation Details
ExpandLesswhen expanded (click to collapse),ExpandMorewhen collapsed (click to expand)