discourse-ai/spec/plugin_helper.rb
Roman Rizzi bed044448c
DEV: Remove old code now that features rely on LlmModels. (#729)
* DEV: Remove old code now that features rely on LlmModels.

* Hide old settings and migrate persona llm overrides

* Remove shadowing special URL + seeding code. Use srv:// prefix instead.
2024-07-30 13:44:57 -03:00

18 lines
529 B
Ruby

# frozen_string_literal: true
module DiscourseAi::ChatBotHelper
def toggle_enabled_bots(bots: [])
LlmModel.update_all(enabled_chat_bot: false)
bots.each { |b| b.update!(enabled_chat_bot: true) }
DiscourseAi::AiBot::SiteSettingsExtension.enable_or_disable_ai_bots
end
def assign_fake_provider_to(setting_name)
Fabricate(:fake_model).tap do |fake_llm|
SiteSetting.public_send("#{setting_name}=", "custom:#{fake_llm.id}")
end
end
end
RSpec.configure { |c| c.include DiscourseAi::ChatBotHelper }