Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/ai_bot/playground.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ def reply_to_chat_message(message, channel, context_post_ids)
in_reply_to_id = channel.direct_message_channel? ? message.id : nil

new_prompts =
bot.reply(context) do |partial, cancel, placeholder|
bot.reply(context) do |partial, cancel, placeholder, type|
# no support for tools or thinking by design
next if !partial.is_a?(String)
next if type == :thinking || type == :tool_details || type == :partial_tool
if !reply
# just eat all leading spaces we can not create the message
next if partial.blank?
Expand Down
9 changes: 8 additions & 1 deletion spec/lib/modules/ai_bot/playground_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,21 @@
guardian: guardian,
)

thinking_partial =
DiscourseAi::Completions::Thinking.new(
message: "I should say hello",
signature: "thinking-signature-123",
partial: true,
)

thinking =
DiscourseAi::Completions::Thinking.new(
message: "I should say hello",
signature: "thinking-signature-123",
partial: false,
)
DiscourseAi::Completions::Llm.with_prepared_responses(
[[thinking, thinking, "wo", "rld", thinking]],
[[thinking_partial, thinking, "wo", "rld"]],
) do |_, _, _prompts|
ChatSDK::Message.create(
channel_id: channel.id,
Expand Down