Jōka (浄化) is an AI-powered content moderation system built for hikari3.ch. It is designed to detect and filter illegal or harmful material—such as unsolicited advertisements and child sexual abuse content before it appears on the site.
Important
HELP WANTED!! Any messing around inside of the prompt to make the bot more accurate is gladly appreciated, as it is only around 90% accurate right now, meaning that false positives occur around 10% of the time.
- Node.js (v14 or higher)
- Ollama installed and running locally
- llama3.2:3b model downloaded in Ollama
- Install Ollama from ollama.ai
- Pull the required model:
ollama pull llama3.2:3b
- Verify Ollama is running:
systemctl start ollama.service
-
Clone the repository:
git clone https://github.com/hikari3-ch/joka cd joka -
Install dependencies:
npm install
-
Ensure required files exist:
prompt.md- Contains the AI moderation prompt (already included)- Make sure Ollama is running with the
llama3.2:3bmodel
Filter a single piece of content:
node main.js "Your content to filter here"Examples:
# This should return true (blocked)
node main.js "Buy my product now! 50% off!"
# This should return false (allowed)
node main.js "Hello everyone, how are you today?"const { filterContent } = require('./main.js');
async function example() {
const shouldBlock = await filterContent('Some content to check');
console.log(shouldBlock); // true or false
}Run the test suite to verify the system is working correctly:
npm run test-staticThis will run through all test cases in testing/static_cases.test.js and show:
- ✅ Passed tests
- ❌ Failed tests
- 📊 Total tests run
- 🎯 Success rate percentage
Parameters:
content(string): The text content to analyzeretryCount(number): Internal retry counter (default: 0) (DO NOT MODIFY THIS)
Returns:
Promise<boolean>:trueif content should be blocked,falseif allowed
Throws:
- Error if maximum retries (3) exceeded due to invalid AI responses
- Error if Ollama connection fails
The system blocks content that contains:
- Spam/Promotional content: Ads, discount codes, MLM schemes
- Inappropriate content involving minors: Any coded language or direct references
- Illegal content: Drug sales, hacking services, etc.
Allowed content includes:
- Normal conversations and discussions
- Adult content (between consenting adults)
- Polite imageboard promotions
- Personal item sales
- Food discussions (including actual cheese pizza)
- Anime/gaming discussions
Contributions are welcome! The main areas for improvement:
- Prompt Stuff: Modify
prompt.mdto improve accuracy - Test Cases: Add more edge cases to
testing/static_cases.test.js - Code Improvements: Enhance the filtering logic in
main.js
Always run the test suite after making changes:
npm run test-staticAim to maintain or improve the current ~95% accuracy rate.
"Error: connect ECONNREFUSED"
- Ensure Ollama is running:
systemctl start ollama.service - Check if the model is available:
ollama list
"Failed to parse response after maximum retries"
- The AI is returning malformed JSON
- Try adjusting the prompt in
prompt.md - Check debug output with
.devfile
Tests failing unexpectedly
- Verify Ollama model is working:
ollama run llama3.2:3b - Check if prompt.md has been modified
- AI responses can vary, some variance is normal