mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 06:28:48 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			874 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			874 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| module DiscourseAi
 | |
|   module Toxicity
 | |
|     class EntryPoint
 | |
|       def load_files
 | |
|         require_relative "scan_queue"
 | |
|         require_relative "toxicity_classification"
 | |
| 
 | |
|         require_relative "jobs/regular/toxicity_classify_post"
 | |
|         require_relative "jobs/regular/toxicity_classify_chat_message"
 | |
|       end
 | |
| 
 | |
|       def inject_into(plugin)
 | |
|         post_analysis_cb = Proc.new { |post| DiscourseAi::Toxicity::ScanQueue.enqueue_post(post) }
 | |
| 
 | |
|         plugin.on(:post_created, &post_analysis_cb)
 | |
|         plugin.on(:post_edited, &post_analysis_cb)
 | |
| 
 | |
|         chat_message_analysis_cb =
 | |
|           Proc.new { |message| DiscourseAi::Toxicity::ScanQueue.enqueue_chat_message(message) }
 | |
| 
 | |
|         plugin.on(:chat_message_created, &chat_message_analysis_cb)
 | |
|         plugin.on(:chat_message_edited, &chat_message_analysis_cb)
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |