DEV Community

Cover image for AI comment moderator
Zubair Naseem
Zubair Naseem

Posted on

AI comment moderator

This is a submission for the Cloudflare AI Challenge.

What I Built

I built a comment system moderated by AI, eliminating the need for a human intervention and saving countless hours on reading useless comments full of spam or profanity.

Demo

https://cf-challenge-comment-system.pages.dev/

My Code

https://github.com/Xubaer/cf-challenge-comment-system

Journey

I never knew how powerful cloudflare really can be and it has pages and workers functionality.
I used cloudflare Ai to moderate comments from users using two different models, one to moderate the comments and the other for sentiment analysis which helps showing the up/down vote counts :D
I hope to make this as a white label project which can be integrated and injected into different websites and apps. It would work as plug and play.

Multiple Models and/or Triple Task Types
Used "@hf/thebloke/openhermes-2.5-mistral-7b-awq" to moderate comments and receive a json format about the comment.
"@cf/huggingface/distilbert-sst-2-int8" for sentiment analysis that helps me add count to the up/down votes for the overall comments.

Top comments (2)

Collapse
 
jonrandy profile image
Jon Randy 🎖️

I tried this comment:

If I were to say "You are a complete idiot!", then that would clearly be unacceptable, but I didn't say that - despite you reacting as if I had

My comment was rejected. I was told to communicate in a civil manner and not be insulting... when I was already doing both of these.

Just goes to show that there are many things where human judgment is needed (moderation being an obvious example), because AI understands essentially nothing.

Collapse
 
xubaer profile image
Zubair Naseem

That's true, the optimal solution is to flag such comments and then be reviewed by a human. I will improve this, since I was taking part in cloudflare ai challenge I didn't had much time adding this but I'll do that and provide an update.
Thanks for the feedback.