Skip to content

A platform for community discussion. Free, open, simple.

FIX: Record `feature_name` for streamed bot replies (#41784)

Rafael dos Santos Silvadd590155e84a
diff --git a/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb b/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb
index 4cb0e14937f..73f086fe3dc 100644
--- a/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb
+++ b/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb
@@ -111,7 +111,11 @@ module DiscourseAi
DiscourseAi::AiBot::Playground
.new(bot)
- .reply_to(post, custom_instructions: custom_instructions) do |partial|
+ .reply_to(
+ post,
+ custom_instructions: custom_instructions,
+ feature_name: "bot",
+ ) do |partial|
next if partial.empty?
write_chunk(io, { partial: partial })
diff --git a/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb b/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb
index 7426969bc73..ff853811b5f 100644
--- a/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb
+++ b/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb
@@ -195,6 +195,7 @@ module DiscourseAi
temperature: @temperature,
top_p: @top_p,
execution_context: execution_context,
+ feature_name: "bot",
}
# Pre-check: if budget already exhausted on resume, force a final