fix: create placeholder after echo so status bubbles appear below
Move placeholder creation from SendCommand to the agent loop, right after the "via MiniApp" echo is sent. This ensures the chat bubble order is: user echo first, then status updates below it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
14333272d4
commit
fd32a28524
2 changed files with 10 additions and 13 deletions
|
|
@ -233,7 +233,7 @@ func gatewayCmd() {
|
|||
|
||||
if webAppURL != "" {
|
||||
provider := &agentLoopDataProvider{loop: agentLoop, workspace: cfg.WorkspacePath()}
|
||||
sender := &telegramCommandSender{bus: msgBus, channelManager: channelManager}
|
||||
sender := &telegramCommandSender{bus: msgBus}
|
||||
miniappNotifier = miniapp.NewStateNotifier()
|
||||
handler := miniapp.NewHandler(provider, sender, cfg.Channels.Telegram.Token, miniappNotifier)
|
||||
agentLoop.OnStateChange = miniappNotifier.Notify
|
||||
|
|
@ -507,21 +507,10 @@ func collectGitRepoInfo(gitRoot string) miniapp.GitInfo {
|
|||
|
||||
// telegramCommandSender injects Mini App commands into the message bus.
|
||||
type telegramCommandSender struct {
|
||||
bus *bus.MessageBus
|
||||
channelManager *channels.Manager
|
||||
bus *bus.MessageBus
|
||||
}
|
||||
|
||||
func (s *telegramCommandSender) SendCommand(senderID, chatID, command string) {
|
||||
// Create a placeholder so status messages (streaming preview, tool progress)
|
||||
// are visible to the user while the LLM processes the request.
|
||||
if s.channelManager != nil {
|
||||
if ch, ok := s.channelManager.GetChannel("telegram"); ok {
|
||||
if tc, ok := ch.(*channels.TelegramChannel); ok {
|
||||
tc.CreatePlaceholder(context.Background(), chatID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s.bus.PublishInbound(bus.InboundMessage{
|
||||
Channel: "telegram",
|
||||
SenderID: senderID,
|
||||
|
|
|
|||
|
|
@ -259,6 +259,14 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
|||
Content: "via MiniApp: " + msg.Content,
|
||||
SkipPlaceholder: true,
|
||||
})
|
||||
// Create a placeholder AFTER the echo so status updates appear below it.
|
||||
if al.channelManager != nil {
|
||||
if ch, ok := al.channelManager.GetChannel(msg.Channel); ok {
|
||||
if tc, ok := ch.(*channels.TelegramChannel); ok {
|
||||
tc.CreatePlaceholder(ctx, msg.ChatID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fast path: handle slash commands immediately without blocking the LLM worker.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue