mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-07 03:58:18 +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.
28 lines
632 B
Ruby
28 lines
632 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Configuration
|
|
class LlmDependencyValidator
|
|
def initialize(opts = {})
|
|
@opts = opts
|
|
end
|
|
|
|
def valid_value?(val)
|
|
return true if val == "f"
|
|
|
|
@llm_dependency_setting_name =
|
|
DiscourseAi::Configuration::LlmValidator.new.choose_llm_setting_for(@opts[:name])
|
|
|
|
SiteSetting.public_send(@llm_dependency_setting_name).present?
|
|
end
|
|
|
|
def error_message
|
|
I18n.t(
|
|
"discourse_ai.llm.configuration.set_llm_first",
|
|
setting: @llm_dependency_setting_name,
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|