mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-10 21:44:42 +00:00
We no longer support the "provider:model" format in the "ai_helper_model" and "ai_embeddings_semantic_search_hyde_model" settings. We'll migrate existing values and work with our new data-driven LLM configs from now on.
18 lines
560 B
Ruby
18 lines
560 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(:llm_model, provider: "fake", name: "fake").tap do |fake_llm|
|
|
SiteSetting.public_send("#{setting_name}=", "custom:#{fake_llm.id}")
|
|
end
|
|
end
|
|
end
|
|
|
|
RSpec.configure { |c| c.include DiscourseAi::ChatBotHelper }
|