DEV: Use `ChatSDK.create` instead of service in specs

This patch will allow upcoming changes to services
(https://github.com/discourse/discourse/pull/29129) without breaking the
`discourse-ai` specs.
This commit is contained in:
Loïc Guitaut 2024-10-16 17:37:07 +02:00 committed by Loïc Guitaut
parent 792703c942
commit 7919173cba
1 changed files with 5 additions and 5 deletions

View File

@ -433,12 +433,12 @@ RSpec.describe DiscourseAi::AiBot::Playground do
DiscourseAi::Completions::Llm.with_prepared_responses(["World"]) do |_, _, _prompts|
prompts = _prompts
::Chat::CreateMessage.call!(
chat_channel_id: dm_channel.id,
message: "Hello",
guardian: guardian,
ChatSDK::Message.create(
raw: "Hello",
channel_id: dm_channel.id,
context_post_ids: [post.id],
).message_instance
guardian:,
)
end
expect(prompts[0].messages[1][:content]).to include("this is post content")