=== AI Support Assistant ===
Contributors: Devumar
Tags: rag, chat, support, gemini, openai
Requires at least: 6.2
Tested up to: 7.1
Stable tag: 1.0.0
Requires PHP: 8.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

RAG support chat assistant for WordPress using Native AI Client or direct OpenAI/Gemini with native WordPress vector search.

== Description ==

AI Support Assistant is a next-generation, high-performance Retrieval-Augmented Generation (RAG) document search and support chat widget for WordPress. It natively integrates with the WordPress 7.0+ AI Client and Connectors API, allowing site owners to power AI chat and vector search using centralized WordPress connectors or standalone direct API keys (Google Gemini and OpenAI GPT-4). Visitors can query your uploaded documentation, guide files, PDFs, DOCX, and TXT files with real-time answers and document citations.

== External Services ==

This plugin utilizes AI provider APIs to generate vector text embeddings and formulate chat query responses. When configured, AI operations can be routed through:
* WordPress Native AI Client & Connectors API (centralized core credentials managed in WordPress Settings > Connectors).
* OpenAI API (https://openai.com) - Used to generate embeddings and retrieve chat answers. Subject to OpenAI's [Terms of Use](https://openai.com/policies/terms-of-use/) and [Privacy Policy](https://openai.com/policies/privacy-policy/).
* Google Gemini API (https://ai.google.dev) - Used to generate embeddings and retrieve chat answers. Subject to Google APIs [Terms of Service](https://developers.google.com/terms) and Google [Privacy Policy](https://policies.google.com/privacy).

When utilizing external LLM services (via WordPress Connectors, OpenAI, or Gemini), document chunks and user search queries are sent to the respective third-party service APIs to formulate answers. No personal user identifiers (like email or IP addresses) are transmitted. Please ensure you have appropriate user consent and reference this integration in your website's Privacy Policy.

== Features ==

* **WordPress Native AI Integration** — Full support for WordPress 7.0+ AI Client & Connectors API
* **Direct Provider Fallback** — Optional direct API key support for Google Gemini and OpenAI GPT-4
* **Native Vector Storage** — Zero-setup local WordPress MySQL vector storage with cosine similarity indexing
* **Document Manager** — Upload, re-index, preview, and delete PDF, DOCX, TXT files
* **Beautiful Chat Widget** — Slide-out panel with typewriter animation, citations, clipboard copy, session history
* **Statistics Dashboard** — Weekly bar charts, token usage, model breakdown, accuracy score
* **Chat Logs Manager** — View, export CSV, delete individual or all logs
* **Gutenberg Block + Shortcode** — Drop the widget on any page or post
* **Security First** — Nonce validation, `manage_options` capability checks, `$wpdb->prepare()` everywhere

== Requirements ==

| Requirement | Minimum |
|---|---|
| WordPress | 6.0+ |
| PHP | 8.2+ |
| MySQL | 5.7+ |

== Installation ==

1. Upload the `ai-support-assistant` folder to `/wp-content/plugins/` or install via the WP Admin **Plugins → Add New** screen.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **AI Support Assistant → Settings** and enter your AI provider API key (OpenAI or Gemini).
4. Go to **AI Support Assistant → Upload** and upload your documentation files (PDF, DOCX, TXT).
5. Paste `[ai_support_assistant]` on any page or post.

== Shortcode Usage ==

`[ai_support_assistant]`
`[ai_support_assistant title="Support" theme="dark" width="400px" height="600px"]`

| Attribute | Default | Description |
|---|---|---|
| `title` | *(settings value)* | Chat widget header title |
| `theme` | `light` | `light`, `dark`, or `glass` |
| `width` | `360px` | Widget width |
| `height` | `500px` | Widget height |

== Frequently Asked Questions ==

= Can I run the plugin entirely locally? =

Yes! By default, the plugin uses your local MySQL database as the vector store. Only the embedding and chat queries require outgoing API requests to your chosen provider (Google Gemini or OpenAI).

= Which file formats are supported? =

The plugin currently supports PDF, DOCX (Microsoft Word), and TXT text files.

= How do I customize the chat widget design? =

You can customize the chat title and dimensions via the shortcode parameters (e.g. `[ai_support_assistant title="Documentation Search" theme="light"]`).

== Screenshots ==

1. Upload and Document Manager in the WordPress admin panel showing indexed files.
2. Chat widget preview on the frontend with AI-generated answers and citations.
3. Statistics dashboard showing weekly bar charts and token usage metrics.
4. Settings page showing provider credentials and vector database configuration options.

== Changelog ==

= 1.0.0 =
* Initial release of AI Support Assistant.

== Upgrade Notice ==

= 1.0.0 =
Initial launch of the AI Support Assistant plugin. Ready for production use.
