fix(im): harden stream finalize and drop collapsed think header

Add agent complete wait timeout and answer fallbacks for cancel paths,
restore Telegram Markdown on finalize with plain-text retry, and show
answer-only final IM frames instead of the collapsed think summary.
This commit is contained in:
wizardchen
2026-06-24 00:58:19 +08:00
committed by lyingbug
parent e6b3ef4f73
commit 7c8b15f022
6 changed files with 111 additions and 73 deletions
+5 -2
View File
@@ -438,8 +438,11 @@ func (a *Adapter) FinalizeStream(ctx context.Context, incoming *im.IncomingMessa
msgID := state.msgID
state.mu.Unlock()
if err := a.editMessage(ctx, chatID, msgID, finalContent, ""); err != nil {
logger.Warnf(ctx, "[Telegram] Failed to finalize stream: %v", err)
if err := a.editMessage(ctx, chatID, msgID, finalContent, "Markdown"); err != nil {
logger.Warnf(ctx, "[Telegram] Markdown finalize failed, retrying plain: %v", err)
if retryErr := a.editMessage(ctx, chatID, msgID, finalContent, ""); retryErr != nil {
logger.Warnf(ctx, "[Telegram] Failed to finalize stream: %v", retryErr)
}
}
return nil
}