Skip to content
Plugin Architecture

Features & Technical Architecture

Explore how BridgeChat AI pairs WordPress-native MySQL vector retrieval with OpenAI, Google Gemini, and Telegram Forum Topics—without external vector SaaS or cache breakage.

Setup Guide
MySQL RAG

Incremental sha256 chunking inside WordPress

Content is split into 1,200-character chunks with 200-character overlap across paragraph and sentence boundaries. Each chunk carries a sha256 content hash so unchanged sections are never re-embedded on save.

  • Auto-indexes on save_post and prunes deleted posts
  • Supports page, post, public CPTs, static HTML files, and FAQ notes
  • Strips inline style/script/svg tags and shortcodes before chunking
Dual BYOK AI

OpenAI and Google Gemini with strict grounding

Switch providers cleanly from WP Admin without vendor lock-in. Structured JSON responses separate the answer from escalation flags and attach up to three source page citation pills.

  • OpenAI default: gpt-4o-mini + text-embedding-3-small
  • Gemini default: gemini-2.5-flash + gemini-embedding-001 (768/1536/3072 dims)
  • Tunable top_k (1–12) and min_similarity (0.00–0.95)
Telegram Topics

One Forum Topic per live visitor conversation

When a visitor clicks Talk to human—or AI sets handoff=true—BridgeChat AI opens a dedicated Forum Topic in your private Telegram group with recent conversation context.

  • Replies posted inside the topic stream straight back to the browser widget
  • Send /ai to hand control back to AI, or /close to mark resolved
  • Webhook authenticated via X-Telegram-Bot-Api-Secret-Token
Cache & Security

Built for CDNs, page caches, and extensibility

Public visitors authenticate via HMAC-SHA256 signed session tokens rather than HTML-baked WordPress nonces, so cached pages remain valid across Cloudflare, Varnish, and WP Fastest Cache.

  • Strict Cache-Control: no-store on all chat REST endpoints
  • Per-IP transient rate limiting on sessions, chat, and handoff
  • Widget visibility modes: Off, Admin Preview Only, or Public

Clean Content Extraction & Incremental Indexing

BridgeChat AI indexes published WordPress pages and posts by default, and supports any public custom post type, excluded post IDs, standalone static HTML files under ABSPATH, and custom plain-text FAQ notes.

Before chunking, the extractor removes inline <style>, <script>, <noscript>, and <svg> blocks plus shortcodes, inserts block-boundary newlines so headings do not merge with body paragraphs, and splits text into 1,200-character chunks with 200-character overlap. Each chunk is hashed with sha256 so unchanged sections are skipped during incremental rebuilds or save_post updates.

Dual BYOK Providers & Grounded JSON Output

Configure your own OpenAI or Google Gemini API key under Settings → BridgeChat AI → AI Provider. Every chat request searches top-K chunks (default 5, configurable 1–12) meeting your minimum cosine similarity threshold (default 0.25) and instructs the model to respond strictly as JSON containing reply, handoff, and handoff_reason.

If a visitor asks for a real human, requests a custom consultation outside indexed context, or context is insufficient, the assistant can automatically open a Telegram Forum Topic when telegram_auto_handoff is enabled.

Two-Way Telegram Forum Topics Bridge

Telegram lets one bot token bind one webhook URL, and Forum Topics keep every visitor conversation isolated in its own thread inside a single private supergroup. Operators can reply directly from Telegram desktop or mobile and send /ai to hand the session back to AI or /close to mark it resolved and close the topic.

WP-CLI Automation & Extensibility

Inspect indexable content before spending embedding tokens with wp bridgechat-ai preview-docs, run incremental indexing with wp bridgechat-ai index, test semantic matches via wp bridgechat-ai search, and verify or register Telegram webhooks with test-telegram and register-webhook.