discourse-ai/plugin.rb

44 lines
1.5 KiB
Ruby
Raw Normal View History

2023-02-17 09:33:47 -05:00
# frozen_string_literal: true
2023-02-22 18:46:53 -05:00
# name: discourse-ai
2023-02-17 09:33:47 -05:00
# about: TODO
# version: 0.0.1
# authors: Discourse
# url: TODO
# required_version: 2.7.0
2023-02-22 18:46:53 -05:00
enabled_site_setting :ai_enabled
2023-02-17 09:33:47 -05:00
2023-02-22 18:46:53 -05:00
after_initialize do
module ::Disorder
PLUGIN_NAME = "discourse-ai"
end
require_relative "lib/shared/inference_manager.rb"
require_relative "lib/modules/toxicity/event_handler.rb"
require_relative "lib/modules/toxicity/classifier.rb"
require_relative "lib/modules/toxicity/post_classifier.rb"
require_relative "lib/modules/toxicity/chat_message_classifier.rb"
require_relative "app/jobs/regular/modules/toxicity/toxicity_classify_post.rb"
require_relative "app/jobs/regular/modules/toxicity/toxicity_classify_chat_message.rb"
require_relative "lib/modules/sentiment/event_handler.rb"
require_relative "lib/modules/sentiment/post_classifier.rb"
require_relative "app/jobs/regular/modules/sentiment/sentiment_classify_post.rb"
on(:post_created) do |post|
DiscourseAI::Toxicity::EventHandler.handle_post_async(post)
DiscourseAI::Sentiment::EventHandler.handle_post_async(post)
end
on(:post_edited) do |post|
DiscourseAI::Toxicity::EventHandler.handle_post_async(post)
DiscourseAI::Sentiment::EventHandler.handle_post_async(post)
end
on(:chat_message_created) do |chat_message|
DiscourseAI::Toxicity::EventHandler.handle_chat_async(chat_message)
end
on(:chat_message_edited) do |chat_message|
DiscourseAI::Toxicity::EventHandler.handle_chat_async(chat_message)
end
end