From 7919173cba3c244d701cd29d3b47bcdbab514bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Wed, 16 Oct 2024 17:37:07 +0200 Subject: [PATCH] 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. --- spec/lib/modules/ai_bot/playground_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/lib/modules/ai_bot/playground_spec.rb b/spec/lib/modules/ai_bot/playground_spec.rb index 08f5d56e..9c98a08a 100644 --- a/spec/lib/modules/ai_bot/playground_spec.rb +++ b/spec/lib/modules/ai_bot/playground_spec.rb @@ -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")