fix: enforce synchronous typing-stop signaling for Monitor UI stability
This commit is contained in:
parent
6ee2bf02e3
commit
9b9796e52f
1 changed files with 6 additions and 18 deletions
|
|
@ -529,24 +529,6 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||||
|
|
||||||
// Process message
|
// Process message
|
||||||
func() {
|
func() {
|
||||||
defer func() {
|
|
||||||
if al.channelManager != nil {
|
|
||||||
al.channelManager.InvokeTypingStop(msg.Channel, msg.ChatID)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
// TODO: Re-enable media cleanup after inbound media is properly consumed by the agent.
|
|
||||||
// Currently disabled because files are deleted before the LLM can access their content.
|
|
||||||
// defer func() {
|
|
||||||
// if al.mediaStore != nil && msg.MediaScope != "" {
|
|
||||||
// if releaseErr := al.mediaStore.ReleaseAll(msg.MediaScope); releaseErr != nil {
|
|
||||||
// logger.WarnCF("agent", "Failed to release media", map[string]any{
|
|
||||||
// "scope": msg.MediaScope,
|
|
||||||
// "error": releaseErr.Error(),
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }()
|
|
||||||
|
|
||||||
drainCanceled := false
|
drainCanceled := false
|
||||||
cancelDrain := func() {
|
cancelDrain := func() {
|
||||||
if drainCanceled {
|
if drainCanceled {
|
||||||
|
|
@ -577,6 +559,9 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||||
if finalResponse != "" {
|
if finalResponse != "" {
|
||||||
al.PublishResponseIfNeeded(ctx, msg.Channel, msg.ChatID, finalResponse)
|
al.PublishResponseIfNeeded(ctx, msg.Channel, msg.ChatID, finalResponse)
|
||||||
}
|
}
|
||||||
|
if al.channelManager != nil {
|
||||||
|
al.channelManager.InvokeTypingStop(msg.Channel, msg.ChatID)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -637,6 +622,9 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||||
if finalResponse != "" {
|
if finalResponse != "" {
|
||||||
al.PublishResponseIfNeeded(ctx, target.Channel, target.ChatID, finalResponse)
|
al.PublishResponseIfNeeded(ctx, target.Channel, target.ChatID, finalResponse)
|
||||||
}
|
}
|
||||||
|
if al.channelManager != nil {
|
||||||
|
al.channelManager.InvokeTypingStop(target.Channel, target.ChatID)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue