=== Fast RAGbot ===
Contributors: adnanhanif920
Tags: chatbot, ai, rag, gemini, openai
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered chatbot with multi-LLM support (Gemini/OpenAI/Claude), multi-domain indexing, document upload, and conversation memory.

== Description ==

Fast RAGbot is an intelligent chatbot that uses Retrieval-Augmented Generation (RAG) with support for multiple AI providers to provide accurate answers based exclusively on your website content.

**Key Features:**

* **Multi-LLM Support**: Choose between Gemini, OpenAI (ChatGPT), or Claude
* **Multi-Domain Indexing**: Index up to 3 different domains
* **Document Upload**: Bulk upload PDF, DOCX, PPTX, XLSX, TXT, XML, CSV
* **Conversation Memory**: Maintains last 5 Q&A turns per session
* **Smart Follow-ups**: Suggests questions when answer not found
* **Widget Customization**: Custom colors, logo, position, theme CSS
* **Pre-chat Form**: Optional name/email collection
* **Chat Logs**: Full conversation logging with CSV export
* **Shortcode Support**: Embed chat anywhere with `[ragbot_chat]`
* **Grounded Responses**: Answers only from your content - no hallucinations
* **Source Citations**: Provides URLs of source pages for transparency
* **Mobile Responsive**: Works perfectly on all devices
* **Security First**: Rate limiting, nonces, and proper sanitization

**How It Works:**

1. Crawls and indexes your website content
2. Creates semantic embeddings using Google Gemini
3. Retrieves relevant content based on user questions
4. Generates contextual answers with source citations
5. Displays responses in a floating chat widget

**Perfect For:**

* Customer support automation
* FAQ assistance
* Product information queries
* Company information lookup
* Documentation assistance

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/fast-ragbot/` directory
2. Activate the plugin through the 'Plugins' screen in WordPress
3. Go to Settings > Fast RAGbot to configure the plugin
4. Get your Google Gemini API key from [Google AI Studio](https://aistudio.google.com/)
5. Enter your API key and website base URL
6. Click "Test API Key" to verify connection
7. Click "Index Website Now" to crawl and index your content
8. The chat widget will appear on your frontend

== Frequently Asked Questions ==

= Which AI providers are supported? =

You can use Gemini (Google), OpenAI (ChatGPT), or Claude (Anthropic). You need an API key from at least one provider.

= How much does it cost to use? =

The plugin is free. You only pay for your chosen AI provider's API usage. Most providers offer generous free tiers.

= What content does it index? =

The plugin indexes HTML pages from up to 3 domains via sitemap.xml or crawling. You can also upload documents: PDF, DOCX, PPTX, XLSX, TXT, XML, CSV.

= Can I customize the chat widget appearance? =

Yes! You can customize widget color, position (bottom-right/left), add custom logo, and enable theme CSS inheritance from the UI/UX settings tab.

= Is it secure? =

Yes, the plugin includes rate limiting, nonce verification, input sanitization, and follows WordPress security best practices.

= Does it work with caching plugins? =

Yes, the plugin is compatible with popular caching plugins like WP Rocket, W3 Total Cache, and WP Super Cache.

= Can I control what content is indexed? =

Yes, the plugin respects robots.txt and only crawls same-domain content. You can also configure crawl depth and limits.

= How many pages can be indexed at once? =

The plugin indexes up to 100 pages per run. For larger websites, simply click "Index" again to continue indexing the next batch. The system tracks progress and shows how many pages are indexed vs remaining.

= What if my website has more than 100 pages? =

Run the indexer multiple times. Each run processes the next 100 unindexed pages. The progress indicator shows total indexed pages and remaining pages to help you track completion.

== Screenshots ==

1. Admin settings page with API configuration
2. Advanced settings with customizable parameters
3. File upload interface for additional content
4. Chat widget on frontend
5. Chat conversation with source citations
6. Indexing progress indicator

== Changelog ==

= 2.0.0 =
* Multi-LLM support: Gemini, OpenAI, Claude
* Multi-domain indexing (up to 3 domains)
* Document upload: PDF, DOCX, PPTX, XLSX, TXT, XML, CSV
* Conversation memory (last 5 turns)
* Smart follow-up suggestions
* Widget customization: color, logo, position
* Pre-chat form for user info collection
* Chat logs with CSV export
* Shortcode support: [ragbot_chat]
* Tabbed settings UI: General, Indexing, Models, UI/UX, Help, Logs
* Theme CSS inheritance option
* Transparent loader (no white box)

= 1.0.0 =
* Initial release
* Google Gemini integration
* Website crawling and indexing
* RAG-based question answering
* Source citations
* Mobile-responsive widget

== Upgrade Notice ==

= 2.0.0 =
Major update with multi-LLM support, multi-domain indexing, document upload, conversation memory, and extensive customization options.

== External Services & Data Usage ==

This plugin connects to external AI services to provide chatbot functionality. Below is a detailed explanation of what data is transmitted and how it is used.

= External Services Used =

**Google Gemini API** (https://ai.google.dev/)
* Used for: Text embeddings and AI text generation
* Data sent: User questions, website content chunks, conversation history
* Privacy Policy: https://policies.google.com/privacy
* Terms of Service: https://policies.google.com/terms

**OpenAI API** (https://openai.com/) - Optional
* Used for: Text embeddings and AI text generation (when selected as active model)
* Data sent: User questions, website content chunks, conversation history
* Privacy Policy: https://openai.com/privacy/
* Terms of Service: https://openai.com/terms/

**Claude API by Anthropic** (https://anthropic.com/) - Optional
* Used for: Text embeddings and AI text generation (when selected as active model)
* Data sent: User questions, website content chunks, conversation history
* Privacy Policy: https://www.anthropic.com/privacy
* Terms of Service: https://www.anthropic.com/legal/terms

= What Data Is Transmitted =

1. **User's Question**: The text message submitted by the website visitor
2. **Retrieved Document Chunks**: Relevant excerpts from your indexed website content (typically 5-8 chunks of ~1000 characters each)
3. **Conversation History**: Last 5 question-answer pairs from the current session
4. **Model Parameters**: Temperature (0.1), max tokens (1000), and other generation settings

= Data Usage & Storage =

* Data is transmitted **only** for generating responses to user questions
* **No data is stored or used for training** by external AI providers (per their API terms)
* Data transmission occurs in real-time and is not cached by the plugin on external servers
* All API communications use HTTPS encryption

= Local WordPress Storage =

The plugin stores the following data in your WordPress database:

**Options (wp_options table)**:
* `ragbot_settings` - Plugin configuration including API keys, widget settings, and preferences

**Custom Tables**:
* `wp_rag_docs` - Indexed website pages and uploaded documents
* `wp_rag_chunks` - Text chunks created from indexed content
* `wp_rag_embeddings` - Vector embeddings for semantic search
* `wp_rag_sources` - Content source configurations (domains, settings)
* `wp_rag_logs` - Chat conversation logs (optional, includes user name/email if pre-chat form enabled)
* `wp_rag_url_queue` - Queue of URLs pending indexing

**Session Data**:
* PHP sessions store temporary conversation history (cleared when session ends)
* Browser sessionStorage stores chat UI state (cleared when tab closes)

= Data Control & Privacy =

**User Control**:
* Delete API keys anytime from Settings > Fast RAGbot > Models tab
* Clear all indexed content using "Clear Index" button
* Reset plugin settings to defaults
* Export or delete chat logs from Settings > Fast RAGbot > Chat Logs tab

**Data Deletion**:
* Deactivating the plugin preserves your data
* Uninstalling the plugin removes all database tables and options
* Use "Clear Index" to remove indexed content without uninstalling

**Privacy Compliance**:
* No data is shared with third parties except your chosen AI provider
* Chat logs are optional and stored locally in your database
* Pre-chat form (name/email collection) is optional and disabled by default
* All user inputs are sanitized and validated
* Rate limiting prevents abuse (10 requests per 60 seconds per IP)

= Developer Privacy Policy =

For questions about data handling, please review:
* Your chosen AI provider's privacy policy (links above)
* Your own website's privacy policy (you are the data controller)
* WordPress.org privacy guidelines: https://wordpress.org/about/privacy/

== Privacy Policy ==

This plugin acts as a data processor, sending user questions to your chosen AI provider. You (the site owner) are the data controller and responsible for:
* Disclosing AI service usage in your privacy policy
* Obtaining user consent where required by law (GDPR, CCPA, etc.)
* Ensuring compliance with local privacy regulations

The plugin stores chat logs locally in your database. If you enable the pre-chat form, user names and emails are stored and should be disclosed in your privacy policy.

== Support ==

For support, please visit the plugin's support forum or contact the developer.

== Credits ==

* Supports embeddings and text generation using Google Gemini, OpenAI, or Claude.
* Built with WordPress coding standards
* Follows accessibility best practices