Skip to content

Commit 55e2466

Browse files
committed
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.
1 parent 2d5f320 commit 55e2466

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

config/config.example.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
"allow_from": [
5757
"YOUR_USER_ID"
5858
],
59-
"reasoning_channel_id": ""
59+
"reasoning_channel_id": "",
60+
"streaming": {
61+
"enabled": true
62+
}
6063
},
6164
"discord": {
6265
"enabled": false,

pkg/agent/loop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ func (al *AgentLoop) runLLMIteration(
740740
// Check if both the provider and channel support streaming
741741
streamProvider, providerCanStream := agent.Provider.(providers.StreamingProvider)
742742
var streamer bus.Streamer
743-
if providerCanStream && opts.SendResponse && !constants.IsInternalChannel(opts.Channel) {
743+
if providerCanStream && !opts.NoHistory && !constants.IsInternalChannel(opts.Channel) {
744744
streamer, _ = al.bus.GetStreamer(ctx, opts.Channel, opts.ChatID)
745745
}
746746

pkg/config/defaults.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func DefaultConfig() *Config {
5858
Enabled: true,
5959
Text: "Thinking... 💭",
6060
},
61+
Streaming: StreamingConfig{Enabled: true},
6162
},
6263
Feishu: FeishuConfig{
6364
Enabled: false,

0 commit comments

Comments
 (0)