fix: clear status indicator on message processing completion
Send status_end from Run() goroutine defer to ensure the Android status indicator is cleared on all exit paths (normal, error, cancel). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d9279c08cc
commit
c4a4ba5d4c
2 changed files with 8 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ class ChatRepositoryImpl(
|
||||||
webSocketClient.incomingMessages.collect { dto ->
|
webSocketClient.incomingMessages.collect { dto ->
|
||||||
when (dto.type) {
|
when (dto.type) {
|
||||||
"status" -> _statusLabel.value = dto.content
|
"status" -> _statusLabel.value = dto.content
|
||||||
|
"status_end" -> _statusLabel.value = null
|
||||||
else -> {
|
else -> {
|
||||||
_statusLabel.value = null
|
_statusLabel.value = null
|
||||||
val entity = MessageMapper.toEntity(dto)
|
val entity = MessageMapper.toEntity(dto)
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,13 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||||
|
|
||||||
go func(m bus.InboundMessage, sk string) {
|
go func(m bus.InboundMessage, sk string) {
|
||||||
defer func() {
|
defer func() {
|
||||||
|
// Clear status indicator on completion (normal, error, or cancel)
|
||||||
|
if !constants.IsInternalChannel(m.Channel) {
|
||||||
|
al.bus.PublishOutbound(bus.OutboundMessage{
|
||||||
|
Channel: m.Channel, ChatID: m.ChatID,
|
||||||
|
Type: "status_end",
|
||||||
|
})
|
||||||
|
}
|
||||||
close(done)
|
close(done)
|
||||||
al.procsMu.Lock()
|
al.procsMu.Lock()
|
||||||
if cur, ok := al.activeProcs[sk]; ok && cur.done == done {
|
if cur, ok := al.activeProcs[sk]; ok && cur.done == done {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue