=== Sentient AI — AI-Powered WordPress Chatbot with Semantic Search, Autopilot & MCP Server ===
Contributors: maidulcu
Tags: ai chatbot, chatbot, openai, customer support, faq, live chat, gpt, claude, gemini, wordpress chatbot, ai assistant, support chatbot, help desk, chat widget, privacy ai, local ai, woocommerce chatbot, vector search, semantic search, mcp server, pinecone, supabase
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A feature-rich AI chatbot for WordPress with semantic vector search, WordPress Autopilot, local browser-based AI, and MCP Server integration.

== Description ==

Sentient AI is a comprehensive WordPress chatbot platform that combines AI-powered conversations with site management, semantic search, and external AI agent integration. It supports multiple AI providers, runs locally without API keys for FAQ matching, and offers enterprise-grade features for privacy-conscious organizations.

= Core Capabilities =

* **Multi-Provider AI** — Supports OpenAI (GPT-4o, GPT-4, GPT-3.5), Claude (Anthropic), Google Gemini, OpenRouter, and Hugging Face. Switch providers without changing your workflow.

* **Semantic Vector Search** — Two-tier architecture: Local MySQL engine for shared hosting (no custom PHP extensions needed) and cloud engines (Pinecone, Supabase) for scale. Finds content by meaning, not just keywords.

* **Browser-Based FAQ Matching** — Answers common questions instantly in the visitor's browser. Zero API costs, works offline, no data leaves the site. Falls back to cloud AI when needed.

* **WordPress Autopilot** — AI agent that manages your WordPress site through chat commands: create posts, check for updates, scan for broken images, clear cache, and more. Administrator-only access.

* **MCP Server** — Expose your chatbot, FAQs, and site analytics to external AI agents via the Model Context Protocol. Connect Claude Desktop, Cursor, or custom AI agents directly to your WordPress installation.

* **GEO Scanner** — Analyze content for Generative Engine Optimization. Score each post/page across 10 factors that determine how AI search engines (Google SGE, Perplexity, ChatGPT Search) evaluate your content. One-click fixes for schema markup.

* **Empathy Engine** — Real-time emotion detection adapts the AI's response tone. Automatically escalates frustrated users to human support.

* **Glass Box Transparency** — Every AI response shows a confidence score (0-100%) with source attribution. Admins can review low-confidence queries and improve their FAQ database.

= Designed for Every Hosting Environment =

* **Shared hosting (Bluehost, SiteGround, GoDaddy, HostGator)** — Local MySQL vector engine works without SSH access or custom PHP extensions
* **Cloud / VPS** — Pinecone or Supabase for high-scale vector search
* **Privacy-first mode** — Local Brain + Privacy Mode = zero external API calls

= Why Choose Sentient AI? =

Unlike basic chatbot plugins, Sentient AI offers:
- Semantic search that understands meaning, not just keywords
- Full site management through chat commands (Autopilot)
- External AI agent integration via MCP (standard protocol)
- Content optimization for AI-powered search engines (GEO)
- Emotion-aware responses with automatic escalation
- Transparent confidence scoring and source attribution
- Privacy-first local processing with zero API costs
- Multi-provider flexibility — use OpenAI, Claude, Gemini, or others

== Installation ==

1. Upload the `sentient-ai` folder to `/wp-content/plugins/`
2. Activate the plugin from the **Plugins** menu
3. Navigate to **Sentient AI → Settings** to configure
4. Select your AI provider and enter your API key in the **AI Providers** tab
5. Enable the chatbot in the **General** tab
6. Customize appearance and behavior in the **Widget** and **Features** tabs
7. Place `[sentient_ai_chat]` on any page, or use the floating widget

== Frequently Asked Questions ==

= Can this work without an API key? =

Yes. The browser-based FAQ matcher and Local Brain feature answer common questions using your FAQ database without any API calls. For AI-generated responses beyond existing FAQs, an API key from a supported provider is required.

= Which AI providers are supported? =

OpenAI (GPT-4o, GPT-4, GPT-3.5), Claude by Anthropic, Google Gemini, OpenRouter (multi-model access), and Hugging Face. You can switch between providers at any time.

= How does the semantic vector search work? =

The Vector Database (v2.8.0) converts your content into mathematical embeddings and stores them for similarity search. The Local MySQL engine works on any shared hosting using standard WordPress tables. For higher scale, Pinecone and Supabase cloud engines handle millions of vectors with SOC 2/GDPR compliance.

= Which vector engine should I choose? =

For shared hosting with under 10,000 posts, the Local MySQL engine works without any additional setup. For larger sites, Pinecone or Supabase offer free tiers and enterprise-grade scalability.

= What is the MCP Server? =

The MCP Server implements the Model Context Protocol, a standard for connecting AI agents to external systems. It allows tools like Claude Desktop, Cursor, or custom AI agents to interact with your WordPress site — querying the chatbot, searching FAQs, managing content, and accessing analytics — all authenticated via API key.

= How does the GEO Scanner help my content? =

Generative Engine Optimization (GEO) ensures your content is cited by AI-powered search engines. The scanner analyzes each post across 10 factors — structured data, FAQ sections, citations, statistics, author expertise, content structure, and more — providing a score (0-100) with actionable suggestions and one-click fixes.

= Does this work with WooCommerce? =

Yes. The chatbot supports product lookup, order status checking, recommendations, and cart information. WooCommerce data is accessible through chat and is included in the Autopilot's site management capabilities.

= Is my data sent to external services? =

Only when you explicitly configure an AI provider API key and a user query requires AI-generated response. FAQ-matched queries, Local Brain responses, and Privacy Mode interactions never leave your server. The plugin holds no data on its own — you control all API keys and provider choices.

= Can I customize the chatbot appearance? =

Yes. Six preset themes (Indigo, Ocean, Emerald, Rose, Amber, Slate) plus custom color pickers, border radius adjustment, and a live preview in settings. You can also configure quick replies, canned responses, and a pre-chat form.

= What is WordPress Autopilot? =

An administrator-only AI agent that executes WordPress tasks through the chat interface. Supported commands include creating posts and pages, listing content, checking for plugin/theme/core updates, finding broken images, clearing cache, and retrieving site statistics. All actions are logged for review.

== Screenshots ==

1. Settings page — Provider configuration, API keys, widget settings, and feature toggles
2. Query Logs — Searchable conversation history with response types and FAQ linking
3. Conversations — Session-based conversation viewer with message threading
4. Low Confidence Queries — AI answers below threshold with create-FAQ actions
5. Sentiment Analytics — Emotion distribution (happy, frustrated, confused) with time range filters
6. Learning Dashboard — Topic clustering, trending topics, auto-FAQ suggestions, and low quality tracking
7. WordPress Autopilot — Available commands, activity log, and site management stats
8. Sentient Insights — Priority-ranked recommendations with action suggestions
9. Train Assistant — Content type selection, field configuration, and training data preview
10. Import FAQs — CSV upload with format instructions and tips

== External Services ==

This plugin connects to external AI service providers to generate intelligent chatbot responses. You must configure API credentials for your chosen provider. **Local Brain mode sends no data to external services.**

=== OpenAI ===
* **Service Purpose**: Provides AI-powered responses through OpenAI's GPT models and Assistants API
* **Data Sent**: User queries, conversation history, and your configured assistant context
* **When Data is Sent**: When a user submits a question that doesn't match an existing FAQ
* **API Endpoints Used**: https://api.openai.com/v1/chat/completions, https://api.openai.com/v1/threads, https://api.openai.com/v1/assistants
* **Terms of Service**: https://openai.com/terms
* **Privacy Policy**: https://openai.com/privacy

=== Claude (Anthropic) ===
* **Service Purpose**: Provides AI-powered responses using Anthropic's Claude models
* **Data Sent**: User queries and conversation history
* **When Data is Sent**: When a user submits a question that doesn't match an existing FAQ
* **API Endpoints Used**: https://api.anthropic.com/v1/messages
* **Terms of Service**: https://www.anthropic.com/legal/consumer-terms
* **Privacy Policy**: https://www.anthropic.com/legal/privacy

=== Google Gemini ===
* **Service Purpose**: Provides AI-powered responses using Google's Gemini models
* **Data Sent**: User queries and conversation history
* **When Data is Sent**: When a user submits a question that doesn't match an existing FAQ
* **API Endpoints Used**: https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent
* **Terms of Service**: https://policies.google.com/terms
* **Privacy Policy**: https://policies.google.com/privacy

=== OpenRouter ===
* **Service Purpose**: Provides access to multiple AI models through a unified API
* **Data Sent**: User queries, conversation history, and FAQ context
* **When Data is Sent**: When a user submits a question that doesn't match an existing FAQ
* **API Endpoints Used**: https://openrouter.ai/api/v1/chat/completions
* **Terms of Service**: https://openrouter.ai/terms
* **Privacy Policy**: https://openrouter.ai/privacy

=== Hugging Face ===
* **Service Purpose**: Provides access to open-source AI models
* **Data Sent**: User queries and conversation history
* **When Data is Sent**: When a user submits a question that doesn't match an existing FAQ
* **API Endpoints Used**: https://api-inference.huggingface.co/models/{model}
* **Terms of Service**: https://huggingface.co/terms-of-service
* **Privacy Policy**: https://huggingface.co/privacy

== Changelog ==

= 2.8.0 =
* New: Vector Database with two-tier semantic search — Local MySQL (shared hosting) and Pinecone/Supabase cloud engines
* New: Auto-generated embeddings for posts, pages, and FAQs with OpenAI API or built-in hash fallback
* New: Semantic search integrated into chatbot responses for meaning-based content matching
* New: Admin settings page with engine selector, cloud provider configuration, and index status dashboard
* Combined 2.7.0 features: MCP Server (8 tools, SSE transport, API key auth, CORS headers)
* Combined 2.7.0 features: GEO Scanner (10-factor content analysis, scoring dashboard, one-click schema fixes)
* Combined 2.7.0 features: Browser-based FAQ matcher with keyword and title matching
* Fixed: Settings reset when saving across tabs (Enable Chatbot, Pre-Chat Form, role limits)
* Fixed: Pre-Chat Form data not persisting across page loads (sessionStorage)
* Fixed: Welcome message not displaying when chat opens
* Fixed: Role limit field blocking form submission when feature is disabled
* Fixed: SSE endpoint infinite loop (timeout added)
* Fixed: Missing content format in MCP manage_wp tool
* Fixed: Unhelpful error message when no API key configured
* Fixed: FAQ matching skipped when conversation history exists
* Chore: Added Help tab with complete feature documentation

= 2.7.0 =
* **MCP Server** — Model Context Protocol support for AI agent integration
* 8 tools: chat, FAQ search/list/create, contacts, stats, low confidence, WordPress management
* 3 resources: FAQ database, usage stats, contacts
* 2 prompts: site overview, FAQ improvement
* API key authentication, SSE transport, CORS, rate limiting
* **GEO Scanner** — 10-factor content analysis for AI search visibility
* Factors: content length, structured data, FAQs, citations, statistics, E-E-A-T, structure, meta, lists, titles
* Scoring dashboard with auto-fix actions
* **Browser-Based FAQ Matcher** — Local FAQ search without API key
* **Bug fixes** — Multi-tab settings persistence, pre-chat form stability, welcome message display
* **Help tab** — Complete feature reference with documentation

= 2.6.0 =
* **Security Hardening** — Remediated Assistant ID leak, added output sanitization
* **Design Refresh** — Modernized UI with CSS variables, improved SVG rendering
* **Bug Fixes** — Resolved ReferenceError, history persistence, transient counting, approval flow

= 2.4.0 =
* **WooCommerce Deep Integration** — Product lookup by name/SKU, order status, recommendations, cart info
* Performance: FAQ query caching, Options_Cache helper

= 2.3.0 =
* **Widget Branding & Theming** — 6 themes, custom colors, border radius, live preview
* **Prompt Injection Protection** — 20+ injection pattern detection

= 2.2.0 =
* **Local Brain** — Fuse.js-powered fuzzy FAQ search in the browser, zero API costs, offline support
* **Privacy Mode** — Restrict all processing to local database

= 2.1.0 =
* **WordPress Autopilot** — 10 commands: updates, broken images, posts, security, cache, stats, health

= 2.0.0 =
* **Sentient Memory** — Topic clustering, feedback tracking, auto-FAQ generation, learning dashboard

= 1.4.0 =
* **Empathy Engine** — Emotion detection and dynamic tone adaptation

= 1.3.0 =
* **Glass Box Transparency** — Confidence scoring and source attribution

= 1.2.0 =
* Multi-turn conversation context and server-side history

= 1.1.1 =
* Security and performance hotfixes

= 1.1.0 =
* Session-based chat history, TXT export, configurable position

= 1.0.0 =
* Initial release with multi-AI support

== Upgrade Notice ==

= 2.8.0 =
Semantic vector search with two-tier architecture. Local MySQL engine works on all shared hosting. Pinecone and Supabase cloud engines for scale. Combined with all 2.7.0 features (MCP Server, GEO Scanner, browser FAQ matcher) and multiple bug fixes.

= 2.7.0 =
MCP Server for AI agent integration, GEO Scanner for AI search optimization, browser-based FAQ matcher, plus multiple stability fixes and the new Help documentation tab.

= 2.6.0 =
Security hardening, redesigned UI, and critical bug fixes. Recommended update for all installations.

= 2.2.0 =
Local Brain — privacy-first local AI processing with zero API costs and offline support.

= 2.1.0 =
WordPress Autopilot — AI agent that manages your site through chat commands.

= 2.0.0 =
Sentient Memory — AI learns from every interaction and improves response quality over time.

= 1.4.0 =
Empathy Engine — AI detects user emotion and adapts its response tone accordingly.

= 1.3.0 =
Glass Box — Confidence scores and source attribution on every AI response.

= 1.2.0 =
Multi-turn conversations with persistent chat history and configurable context.
