mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 06:28:48 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			627 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			627 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| module ::DiscourseAi
 | |
|   class PostClassificator < Classificator
 | |
|     private
 | |
| 
 | |
|     def flag!(post, classification, verdicts, accuracies)
 | |
|       post.hide!(ReviewableScore.types[:inappropriate])
 | |
| 
 | |
|       reviewable =
 | |
|         ReviewableAiPost.needs_review!(
 | |
|           created_by: Discourse.system_user,
 | |
|           target: post,
 | |
|           reviewable_by_moderator: true,
 | |
|           potential_spam: false,
 | |
|           payload: {
 | |
|             classification: classification,
 | |
|             accuracies: accuracies,
 | |
|             verdicts: verdicts,
 | |
|           },
 | |
|         )
 | |
| 
 | |
|       add_score(reviewable)
 | |
|     end
 | |
|   end
 | |
| end
 |