2024-05-28 09:31:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "enum_site_setting"
|
|
|
|
|
|
|
|
module DiscourseAi
|
|
|
|
module Configuration
|
|
|
|
class LlmVisionEnumerator < ::EnumSiteSetting
|
|
|
|
def self.valid_value?(val)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.values
|
2024-07-24 15:29:47 -04:00
|
|
|
values = DB.query_hash(<<~SQL).map(&:symbolize_keys)
|
|
|
|
SELECT display_name AS name, id AS value
|
|
|
|
FROM llm_models
|
|
|
|
WHERE vision_enabled
|
|
|
|
SQL
|
2024-05-28 09:31:15 -04:00
|
|
|
|
2024-07-24 15:29:47 -04:00
|
|
|
values.each { |value_h| value_h[:value] = "custom:#{value_h[:value]}" }
|
2024-05-28 09:31:15 -04:00
|
|
|
|
2024-07-24 15:29:47 -04:00
|
|
|
values
|
2024-05-28 09:31:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|