npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

peertube-plugin-german-ai-mod

v0.3.7

Published

Local AI moderation for German comments using ml6team DistilBERT and deepset BERT models

Readme

PeerTube Plugin: German AI Moderation

AI-powered comment moderation plugin for PeerTube using two-stage German toxicity detection with ml6team DistilBERT and deepset BERT models.

Features

  • Dual-Model System:
    • Primary: ml6team/distilbert-base-german-cased-toxic-comments - Fast general toxicity detection (67M, optimized for comments)
    • Secondary: deepset/bert-base-german-cased-hatespeech-GermEval18Coarse - Specialized hate speech detection
  • German Language Detection: Automatically detects comment language using langdetect
  • Two-Level Filtering:
    • General toxicity threshold (configurable, default: 0.7)
    • Hate speech threshold (configurable, default: 0.5)
  • Non-German Comments: Configurable action for comments in other languages (moderation queue or block)
  • Fail-Open Strategy: Comments are allowed if AI service is unavailable (prevents site breakage)

Requirements

  • PeerTube >= 7.0.0
  • AI moderation service (FastAPI) running in Docker network
  • Docker container with AI service accessible at http://ai-moderator:8000/analyze

Installation

  1. Install via PeerTube admin panel:

    • Go to Administration → Plugins/Themes
    • Click Install a plugin/the theme
    • Enter package name: peertube-plugin-german-ai-mod
    • Or upload ZIP file
  2. Or install via npm:

    npm install peertube-plugin-german-ai-mod

Configuration

After installation, configure the plugin in PeerTube admin panel:

  • AI Endpoint URL: URL of the AI moderation service (default: http://ai-moderator:8000/analyze)
  • Toxizitäts-Schwelle (0–1): Threshold for general toxicity detection (default: 0.7)
  • Hate Speech Schwelle (0–1): Threshold for hate speech detection (default: 0.5)
  • Aktion für nicht-deutsche Kommentare:
    • Zur Moderation zurückhalten - Send to moderation queue (default)
    • Blockieren - Block immediately

Recommended Thresholds

  • Moderate (default): Toxicity 0.7, Hate Speech 0.5 - Blocks only explicit insults
  • Strict: Toxicity 0.5, Hate Speech 0.4 - Blocks more aggressive comments
  • Soft: Toxicity 0.8, Hate Speech 0.6 - Blocks only very explicit insults

AI Service Setup

This plugin requires a separate AI moderation service. See the ai-moderation directory for FastAPI service setup with Docker.

The AI service should provide a POST endpoint /analyze that accepts:

{
  "text": "comment text here"
}

And returns:

{
  "toxic": false,
  "score": 0.15,
  "language": "de",
  "is_german": true,
  "requires_moderation": false,
  "hate_score": 0.05
}

Where:

  • toxic: boolean - whether comment should be blocked (based on thresholds)
  • score: float (0-1) - general toxicity score from primary model
  • hate_score: float (0-1) - hate speech score from secondary model
  • language: string - detected language code
  • is_german: boolean - whether comment is in German
  • requires_moderation: boolean - whether comment requires manual review

How It Works

  1. When a comment is created, the plugin sends it to the AI service
  2. AI service detects the language using langdetect
  3. For non-German comments: sends to moderation or blocks (based on settings)
  4. For German comments:
    • Primary model checks general toxicity
    • Secondary model checks for hate speech
    • Comment is blocked if score >= toxicity_threshold OR hate_score >= hate_threshold
  5. Toxic/hate speech comments are automatically blocked

Hooks Used

  • filter:api.video-thread.create.accept.result - Main comments
  • filter:api.video-comment-reply.create.accept.result - Replies
  • filter:activity-pub.remote-video-comment.create.accept.result - Federated comments

Models Used

  • Primary: ml6team/distilbert-base-german-cased-toxic-comments
    • Lightweight (67M parameters)
    • Trained on 5 German toxicity datasets
    • Optimized for comment toxicity detection
  • Secondary: deepset/bert-base-german-cased-hatespeech-GermEval18Coarse
    • Specialized for hate speech detection
    • Trained on GermEval18 dataset
    • Coarse-grained classification

License

AGPL-3.0

Author

yarkolife