mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 14:38:37 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			662 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			662 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| module ::DiscourseAi
 | |
|   class ChatMessageClassificator < Classificator
 | |
|     private
 | |
| 
 | |
|     def flag!(chat_message, classification, verdicts, accuracies)
 | |
|       reviewable =
 | |
|         ReviewableAiChatMessage.needs_review!(
 | |
|           created_by: Discourse.system_user,
 | |
|           target: chat_message,
 | |
|           reviewable_by_moderator: true,
 | |
|           potential_spam: false,
 | |
|           payload: {
 | |
|             classification: classification,
 | |
|             accuracies: accuracies,
 | |
|             verdicts: verdicts,
 | |
|           },
 | |
|         )
 | |
|       reviewable.update(target_created_by: chat_message.user)
 | |
| 
 | |
|       add_score(reviewable)
 | |
|     end
 | |
|   end
 | |
| end
 |