Content Generation
How AI-generated comments work
Generation Flow
When a visitor views a page with the AIGCS widget, the following happens:
Triggering Generation
| Method | Description |
|---|---|
| On Page View | When autoGenerate is enabled, first visitor triggers it |
| RSS Import | Import RSS/Atom/Sitemap URLs, cron job generates comments |
| Manual | Admin panel: Cache → Fetch & Generate |
| Cache Warm | Admin panel: batch generate for multiple pages |
| Ping Webhook | External system triggers generation via signed URL |
Page Content Extraction
When fetching page content for AI generation, AIGCS uses a fallback chain:
Content Selectors
Built-in selectors cover popular CMS and frameworks:
- WordPress:
article,.post-content,.entry-content - Hugo:
.post-content,.article-content - Hexo:
.post-content,.article-entry - Ghost:
.post-full-content,.article-content - Jekyll:
.post-content,.entry-content - VuePress:
.theme-default-content - And 38+ more...
Prompt System
The prompt assembly follows this order:
Prompt templates exist for 8 languages: zh, en, ja, ko, fr, es, de, pt.
Content Sanitization
AI-generated content is sanitized server-side with DOMPurify:
Allowed tags: p, br, strong, em, b, i, a, ul, ol, li, blockquote, pre, code, h1-h6
Deduplication
Comments are deduplicated using content_md5 — an MD5 hash of the generated content.
This prevents identical comments from being stored multiple times.
Page Locking
A page-level lock prevents concurrent generation:
Cache Architecture
| Layer | Implementation | TTL |
|---|---|---|
| Memory | In-memory LRU (max 1000 entries) | 300s |
| Redis | Optional, configured via plugin | Configurable |
| CDN | ETag + Cache-Control headers | s-maxage=300 |
RSS Integration
RSS Import
AIGCS can import URLs from RSS/Atom feeds and sitemaps:
Supported formats:
- RSS 2.0 —
<item>entries - Atom —
<entry>entries - Sitemap —
<url>entries
Cron Scheduling
| Preset | Cron Expression |
|---|---|
| Hourly | 0 * * * * |
| Every 6 hours | 0 */6 * * * |
| Daily | 0 0 * * * |
| Weekly | 0 0 * * 0 |
Custom 5-field cron expressions are also supported.
Cache Warming & Bulk Generation
Batch generate AI comments for multiple pages with advanced generation policies and controls:
- Custom Concurrency — Configurable concurrency setting without upper limits (defaults to 1) for high-throughput performance
- Overwrite vs. Skip Policy — Choose between
Overwrite existing commentsorSkip pages with existing comments - Fallback Title Option (fallbackTitleIfEmpty) — Automatically fallback to using the page title if body content extraction is empty
- Real-time Task Progress Card — Top navbar card displaying real-time progress bars, success/failed/skipped counts, active path, and one-click cancellation
- Provider Filtering & CSS Selectors — Limit generation to specific AI providers and override content extraction selectors