=== Sentient AI - WordPress AI Chatbot with Glass Box Transparency ===
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
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The only WordPress AI chatbot with transparent confidence scoring and source attribution. Know why your AI answered what it answered.

== Description ==

**Sentient AI** is a revolutionary WordPress chatbot plugin that doesn't just answer questions — it shows you *why* it answered what it answered. With transparent confidence scoring, source attribution, and continuous learning, it's the most trustworthy AI chatbot for WordPress.

= Why Sentient AI is Different =

Unlike other chatbots that are black boxes, Sentient AI includes:

* **Glass Box Transparency** — Every response shows a confidence score (High/Medium/Low) and which pages or FAQs the AI used
* **Multi-Turn Conversations** — AI remembers previous messages for contextual, natural conversations
* **Smart FAQ Matching** — Keyword matching with confidence scoring finds the best answers
* **5 AI Providers** — OpenAI (GPT-4, GPT-3.5), Claude (Anthropic), Google Gemini, OpenRouter, Hugging Face
* **Server-Side Chat History** — Conversations persist across page reloads and devices
* **Auto-Escalation** — Low-confidence answers automatically offer "Talk to a human"

= Perfect For =

* **SaaS companies** — Reduce support tickets with AI that knows your product
* **E-commerce stores** — Answer product questions instantly (WooCommerce compatible)
* **Agencies** — Deploy smart chatbots for clients with transparent AI
* **Membership sites** — Help members find answers without human support
* **Blogs & content sites** — Guide readers to relevant content automatically

= Key Features =

**Glass Box Transparency (v1.3.0)**
* Confidence scoring on every AI response (0-100%)
* Source attribution showing which pages/FAQs were used
* Auto-escalation when confidence is low
* Low confidence dashboard for admin review

**Multi-Turn AI Conversations**
* AI remembers previous messages in the conversation
* Configurable context size (3-20 messages)
* Server-side conversation persistence for logged-in users
* Session-based history for guests

**Smart FAQ System**
* Custom FAQ post type with keyword matching
* Confidence-scored FAQ matches
* Auto-create FAQs from chat logs
* CSV import for bulk FAQ upload

**Training Assistant**
* Train AI on your WordPress pages and posts
* WooCommerce product training (Pro)
* Custom post type training (Pro)
* Preview before upload

**Enterprise-Ready Security**
* Rate limiting (5 requests/minute/IP)
* Nonce verification on all AJAX calls
* Capability checks on admin operations
* Input sanitization and output escaping

**Developer-Friendly**
* OOP architecture with namespaces
* Hooks and filters for customization
* REST API ready (coming soon)
* Translation-ready with text domain

= What Users Say =

> "Finally, a chatbot that doesn't just guess — it shows its work." — WordPress developer

> "The confidence scores helped me identify exactly which FAQs needed improvement." — E-commerce owner

> "Reduced our support tickets by 40% in the first month." — SaaS company

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/sentient-ai`
2. Activate the plugin from the **Plugins** menu
3. Go to **Sentient AI → Settings** to configure your AI provider and API key
4. Enable the chatbot and customize the welcome message
5. Place `[sentient_ai_chat]` on any page, or use the floating widget

== Frequently Asked Questions ==

= Does this work without an API key? =

No. You need your own API key from one of the supported providers (OpenAI, Claude, Gemini, OpenRouter, or Hugging Face). The plugin doesn't bundle any AI access.

= What makes this different from other chatbot plugins? =

**Transparency.** Every response shows a confidence score and source attribution. You know exactly why the AI answered what it answered. Other chatbots are black boxes.

= Does it work with WooCommerce? =

Yes! The chatbot works alongside WooCommerce. You can train the AI on your product pages and answer customer questions instantly.

= Can I customize the chatbot's appearance? =

Yes. You can change the welcome message, chat position (left/right), colors via CSS, and toggle confidence scores and source links.

= Does it slow down my website? =

No. The chatbot loads asynchronously in the footer and only loads when enabled. The CSS and JS are lightweight (~15KB combined).

= Is the chat history stored? =

Yes. For logged-in users, conversation history is stored in the database and persists across sessions. For guests, it's stored in the browser session. Admins can view and manage all conversations.

= What happens when the AI gives a wrong answer? =

When confidence is below your threshold (default 50%), the chatbot automatically shows a "Talk to a human" button. You can also review low-confidence queries in the admin dashboard and create FAQs for common questions.

= Does it support multiple languages? =

The chatbot UI supports translation via the standard WordPress text domain system. The AI can respond in any language your AI provider supports.

== Screenshots ==

1. AI chatbot on frontend with confidence badge and source attribution
2. Admin settings page with provider configuration
3. Glass Box: Confidence scores and source links on each response
4. Low confidence dashboard showing queries that need attention
5. Conversations page with full chat history
6. Training assistant for importing WordPress content

== External Services ==

This plugin connects to external AI service providers to generate intelligent chatbot responses. The plugin requires you to configure API credentials for your selected provider.

=== 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 ==

= 1.3.0 =
* **Glass Box Transparency** — Every AI response now shows confidence scoring (High/Medium/Low)
* **Source Attribution** — See which pages or FAQs the AI used to generate its answer
* **Auto-Escalation** — Low-confidence answers offer "Talk to a human" button
* **Low Confidence Dashboard** — Admin page to review and address weak AI answers
* **Confidence Settings** — Toggle confidence badges, sources, and escalation threshold
* Added Confidence_Scorer and Source_Tracker classes

= 1.2.0 =
* Added multi-turn conversation context — AI now remembers previous messages
* Added server-side conversation history persistence for logged-in users
* Added configurable context size setting (0-20 messages)
* Added Conversations admin page to view and manage chat history
* All 5 AI providers now support conversation history

= 1.1.1 =
* Fixed rate limiting using transients (works without object cache)
* Fixed FAQ meta save capability check bypass
* Fixed DROP TABLE syntax in uninstall script
* Reduced OpenAI polling max block from 20s to 15s
* Fixed transient bombing on logs page (20 transients -> 1)

= 1.1.0 =
* Added session-based conversation history persistence
* Added TXT export and clear history controls
* Added configurable chat bubble position (bottom-right or bottom-left)
* Improved chat accessibility with ARIA live region and log semantics

= 1.0.0 =
* Initial release with OpenAI, Claude, Gemini, Hugging Face, OpenRouter support
* FAQ response system with fallback AI logic
* Shortcode and floating widget
* Query logs, auto-FAQ generation, and training assistant

== Upgrade Notice ==

= 1.3.0 =
**Major update**: Glass Box Transparency — see confidence scores and sources on every AI answer. Identify weak answers and improve your FAQs.

= 1.2.0 =
Multi-turn AI conversations and persistent chat history. AI now remembers context.

= 1.1.1 =
Security and performance hotfixes. Recommended update.

= 1.1.0 =
Chat history persistence, export, accessibility improvements.

= 1.0.0 =
First release with multi-AI support.
