Enable command queueing and fix message duplication issues

- Remove sending() state blocking to allow queueing multiple messages
- Add optimistic message creation with temp IDs for immediate UI feedback
- Implement QUEUED badge display matching TUI behavior (accent color, bold)
- Compute queued state: user message ID > last assistant message ID
- Clear prompt input immediately before async send for better UX
- Fix duplicate messages by properly finding and replacing temp messages
- Fix duplicate parts by clearing optimistic parts when real message arrives
- Fix state mutation bugs in message.part.updated handler (immutable updates)
- Fix state mutation bugs in message.updated handler (immutable updates)

Matches TUI implementation for consistent user experience across clients.
This commit is contained in:
Shantur Rathore
2025-10-24 16:38:42 +01:00
parent e3bc947195
commit 7be4248e20
5 changed files with 149 additions and 73 deletions

View File

@@ -189,9 +189,22 @@ body {
}
.message-content {
display: flex;
flex-direction: column;
gap: 8px;
padding-top: 6px;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-word;
}
.message-queued-badge {
display: inline-block;
background-color: var(--accent-color);
color: white;
font-weight: bold;
padding: 4px 12px;
border-radius: 4px;
margin-bottom: 12px;
font-size: 12px;
letter-spacing: 0.5px;
}
.message-text {