mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-07 20:18:16 +00:00
Previous to this change we could flag, but there was no way to hide content and treat the flag as spam. We had the option to hide topics, but this is not desirable for a spam reply. New option allows triage to hide a post if it is a reply, if the post happens to be the first post on the topic, the topic will be hidden.
29 lines
773 B
Ruby
29 lines
773 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Automation
|
|
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
|
|
def self.available_models
|
|
values = DB.query_hash(<<~SQL)
|
|
SELECT display_name AS translated_name, id AS id
|
|
FROM llm_models
|
|
SQL
|
|
|
|
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"]}" }
|
|
|
|
values
|
|
end
|
|
end
|
|
end
|