2023-12-18 20:04:15 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscourseAi
|
|
|
|
module Automation
|
2024-10-04 02:11:30 -04:00
|
|
|
def self.flag_types
|
|
|
|
[
|
|
|
|
{ id: "review", translated_name: I18n.t("discourse_automation.ai.flag_types.review") },
|
|
|
|
{ id: "spam", translated_name: I18n.t("discourse_automation.ai.flag_types.spam") },
|
|
|
|
]
|
|
|
|
end
|
2024-06-20 18:07:17 -04:00
|
|
|
def self.available_models
|
|
|
|
values = DB.query_hash(<<~SQL)
|
|
|
|
SELECT display_name AS translated_name, id AS id
|
|
|
|
FROM llm_models
|
|
|
|
SQL
|
2024-03-20 20:32:35 -04:00
|
|
|
|
2024-08-28 14:57:58 -04:00
|
|
|
values =
|
|
|
|
values
|
|
|
|
.filter do |value_h|
|
|
|
|
value_h["id"] > 0 ||
|
|
|
|
SiteSetting.ai_automation_allowed_seeded_models_map.includes?(value_h["id"].to_s)
|
|
|
|
end
|
|
|
|
.each { |value_h| value_h["id"] = "custom:#{value_h["id"]}" }
|
2024-05-13 11:46:42 -04:00
|
|
|
|
2024-06-20 18:07:17 -04:00
|
|
|
values
|
2024-03-20 20:32:35 -04:00
|
|
|
end
|
2023-12-18 20:04:15 -05:00
|
|
|
end
|
|
|
|
end
|