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 Warm
Batch generate comments for multiple pages with configurable:
- Concurrency — 1 to 20 parallel requests
- Interval — delay between batches (to avoid rate limits)
- Provider filter — limit to specific AI providers
- CSS selector — override content extraction