fix(streaming): guard streamer for non-sendable messages, add streaming config

Skip streamer acquisition for heartbeat (NoHistory=true), preventing
HEARTBEAT_OK from leaking to Telegram via streamer.Finalize().

Add streaming.enabled to Telegram defaults and example config.
This commit is contained in:
Amir Mamaghani 2026-03-04 19:33:13 +01:00
parent 2d5f320168
commit 55e2466a68
3 changed files with 6 additions and 2 deletions

View file

@ -56,7 +56,10 @@
"allow_from": [ "allow_from": [
"YOUR_USER_ID" "YOUR_USER_ID"
], ],
"reasoning_channel_id": "" "reasoning_channel_id": "",
"streaming": {
"enabled": true
}
}, },
"discord": { "discord": {
"enabled": false, "enabled": false,

View file

@ -740,7 +740,7 @@ func (al *AgentLoop) runLLMIteration(
// Check if both the provider and channel support streaming // Check if both the provider and channel support streaming
streamProvider, providerCanStream := agent.Provider.(providers.StreamingProvider) streamProvider, providerCanStream := agent.Provider.(providers.StreamingProvider)
var streamer bus.Streamer var streamer bus.Streamer
if providerCanStream && opts.SendResponse && !constants.IsInternalChannel(opts.Channel) { if providerCanStream && !opts.NoHistory && !constants.IsInternalChannel(opts.Channel) {
streamer, _ = al.bus.GetStreamer(ctx, opts.Channel, opts.ChatID) streamer, _ = al.bus.GetStreamer(ctx, opts.Channel, opts.ChatID)
} }

View file

@ -58,6 +58,7 @@ func DefaultConfig() *Config {
Enabled: true, Enabled: true,
Text: "Thinking... 💭", Text: "Thinking... 💭",
}, },
Streaming: StreamingConfig{Enabled: true},
}, },
Feishu: FeishuConfig{ Feishu: FeishuConfig{
Enabled: false, Enabled: false,