=== Inqyra ===
Contributors: ipportunities
Tags: ai chatbot, chatbot, live chat, openai, rag
Requires at least: 6.2
Tested up to: 6.9
Requires PHP: 8.1
Stable tag: 1.1.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered chatbot that answers visitor questions based on your own WordPress content. Bring your own API key — zero markup.

== Description ==

Inqyra adds an intelligent chatbot to your WordPress site that answers visitor questions based on your pages, posts, and documents. Connect your own AI provider, keep your data on your server, and pay only what the AI actually costs.

**Bring Your Own Key (BYOK)** — You connect directly to your AI provider. No middleman, no markup. A typical conversation costs ~$0.003 with GPT-4o-mini.

= 5 AI Providers =

Choose from OpenAI, Google Gemini, Anthropic (Claude), Mistral, or DeepSeek. Switch providers or models at any time — your content stays indexed.

= How It Works =

Inqyra uses Retrieval-Augmented Generation (RAG) to ground every answer in your actual content:

1. **Crawl** — Inqyra indexes your pages, posts, and custom post types
2. **Embed** — Content is converted to vector embeddings entirely in your browser (your content never leaves your server)
3. **Search** — When a visitor asks a question, Inqyra finds the most relevant content using vector similarity, keyword matching, and title/path boosting
4. **Answer** — The relevant context is sent to your chosen AI provider, which generates a grounded response

= Key Features =

* **5 AI providers** — OpenAI, Gemini, Claude, Mistral, DeepSeek
* **Browser-based embeddings** — Content never leaves your server for indexing
* **29 languages** — Dutch, English, German, French, Spanish, Italian, Portuguese, and 22 more
* **Customizable widget** — Colors, position, greeting, header, powered-by text
* **Auto-recrawl** — Content re-indexes automatically when you update a post
* **Cost & token tracking** — Monitor API usage and set budget limits
* **Rate limiting** — Built-in IP-based rate limiting (20/min, 200/hr)
* **API key encryption** — Keys encrypted at rest with AES-256-CBC
* **No cookies** — The plugin does not set any cookies
* **Lightweight** — Loads asynchronously with minimal impact on Core Web Vitals
* **Setup wizard** — Live in under 5 minutes with the guided setup

= Free Features =

* Floating chat widget with full customization
* Unlimited pages indexed (post type: pages)
* All 5 AI providers (BYOK)
* Browser-based embeddings
* RAG-powered answers
* Conversation tracking (last 30 days)
* Auto-recrawl on content changes
* Cost & token tracking with budget limits
* Query rewriting (LLM-powered query expansion)
* 29-language support

= Premium Features =

* Index posts, products & custom post types
* Document upload (PDF, DOCX)
* Synonym management for improved search matching
* Webhooks (Zapier, Make, CRM integration)
* Lead extraction (email, phone, name, company)
* Advanced analytics & statistics export
* Page targeting (show widget on specific pages)
* Extended conversation history & analytics
* Escalation & appointment request detection
* Email support

= Works With Any Theme =

Compatible with all modern WordPress themes and page builders including Elementor, Divi, Gutenberg, and WPBakery.

= Privacy First =

* Embeddings are generated entirely in the browser — your content never leaves your server during indexing
* Only when a visitor asks a question does relevant context go to the AI provider, through your own API key
* No cookies are set by the plugin
* GDPR-friendly architecture
* Built in the Netherlands by Ipportunities B.V.

== Installation ==

1. Go to **Plugins > Add New** in your WordPress admin
2. Search for "Inqyra" and click **Install Now**
3. Click **Activate** — the setup wizard starts automatically
4. Choose your AI provider and paste your API key
5. Select which content to index and click **Index Now**
6. Customize the chat widget appearance
7. Done — the chatbot is live on your site

Or upload the plugin ZIP via **Plugins > Add New > Upload Plugin**.

== Frequently Asked Questions ==

= Do I need programming knowledge? =

No. Inqyra is fully no-code. Install the plugin, add your API key, and configure everything through the visual interface and setup wizard.

= Do I need my own AI account? =

Yes. You need an API key from at least one supported provider: OpenAI, Google (Gemini), Anthropic (Claude), Mistral, or DeepSeek. This gives you full control over costs and data.

= What does a conversation cost? =

With GPT-4o-mini, approximately $0.003 per conversation. With GPT-4o, roughly $0.01–$0.03. With Gemini Flash, as low as $0.001. You pay the AI provider directly — Inqyra adds zero markup.

= How is this different from other AI chat plugins? =

Most plugins charge per message or mark up API costs. With Inqyra, you pay the AI provider directly at their published rates. Browser-based embeddings mean your content never leaves your server during indexing. You can switch AI providers at any time without re-indexing.

= Does it work with WooCommerce? =

Yes. With Inqyra Premium, you can index WooCommerce products and any other custom post type. The free version indexes pages.

= Is it GDPR compliant? =

Inqyra is designed with privacy in mind. Embeddings are generated in the browser (no third-party processing during indexing), no cookies are set, and the plugin is built in the Netherlands. When a visitor chats, only the relevant context is sent to your chosen AI provider through your own API key.

= What happens when I hit my budget limit? =

The chat widget stops responding for the rest of the day. Limits reset at midnight (server time). You can configure daily token limits, hourly request limits, and cost limits per agent.

= Can visitors chat in different languages? =

Yes. Inqyra supports 29 languages. The chatbot responds in the language configured for your agent. The multilingual embedding model handles content in any supported language.

= What file formats can I upload? =

With Inqyra Premium, you can upload PDF and DOCX files (up to 10 MB each). These are chunked and indexed alongside your website content.

== Screenshots ==

1. Chat widget on a live website
2. Setup wizard — choose your AI provider
3. Dashboard with conversation statistics
4. Knowledge base management
5. Widget customization settings
6. Conversation history detail view

== External services ==

This plugin connects to external third-party services to provide AI chatbot functionality. All connections require the site administrator to explicitly configure an API key before any data is sent. No data is transmitted without the administrator's action.

= AI Chat Providers =

When a visitor sends a message through the chat widget, the visitor's message along with relevant content from your website (retrieved via RAG search) and the system prompt configured by the administrator are sent to the chosen AI provider. The administrator selects which provider to use and provides their own API key. Only one provider is active at a time.

**Anthropic (Claude)**
API endpoint: https://api.anthropic.com/v1/messages
Used for: Generating chat responses based on your website content.
[Terms of Service](https://www.anthropic.com/terms) | [Privacy Policy](https://www.anthropic.com/privacy)

**OpenAI**
API endpoint: https://api.openai.com/v1/chat/completions
Used for: Generating chat responses based on your website content.
[Terms of Use](https://openai.com/terms) | [Privacy Policy](https://openai.com/privacy)

**Google Gemini**
API endpoint: https://generativelanguage.googleapis.com/v1beta/models/
Used for: Generating chat responses based on your website content.
[Terms of Service](https://policies.google.com/terms) | [Privacy Policy](https://policies.google.com/privacy)

**Mistral AI**
API endpoint: https://api.mistral.ai/v1/chat/completions
Used for: Generating chat responses based on your website content.
[Terms of Service](https://mistral.ai/terms-of-service) | [Privacy Policy](https://mistral.ai/privacy-policy)

**DeepSeek**
API endpoint: https://api.deepseek.com/v1/chat/completions
Used for: Generating chat responses based on your website content.
[Terms of Service](https://platform.deepseek.com/terms) | [Privacy Policy](https://platform.deepseek.com/privacy)

= HuggingFace Transformers.js (ML Inference Service) =

This plugin uses the Transformers.js library to perform machine learning inference entirely in the browser for generating vector embeddings. The JavaScript library itself (~850 KB) is bundled locally within the plugin at `assets/js/vendor/transformers.min.js`.

When the administrator triggers content indexing, the library downloads the ML model files (~50 MB) and WebAssembly runtime from HuggingFace CDN to the user's browser. This is a service — the model files cannot be bundled locally in the plugin due to their size.

No website content or user data is sent to HuggingFace — the model runs locally in the browser after download. The CDN only serves the model files.

Library: @huggingface/transformers v3.4.1 (bundled locally)
Model: Xenova/paraphrase-multilingual-MiniLM-L12-v2 (loaded from huggingface.co at runtime)
[HuggingFace Terms](https://huggingface.co/terms-of-service) | [HuggingFace Privacy](https://huggingface.co/privacy)

= Freemius =

This plugin uses Freemius for license management, plugin updates, and optional usage analytics. When the plugin is activated, Freemius may communicate with its servers to validate licenses, deliver updates, and collect anonymous usage data (if the user opts in). Users are prompted for consent before any analytics data is collected.

[Terms of Service](https://freemius.com/terms) | [Privacy Policy](https://freemius.com/privacy)

== Changelog ==

= 1.1.5 =
* Improved query rewriting: switched from query expansion to keyword-based rewriting strategy with conversation context for better follow-up question handling
* Added temperature control (0.3) for more consistent query rewrites
* All AI providers now support the temperature option
* Input placeholder text now available in all 29 supported languages
* Added customizable input placeholder field in widget settings (with option to hide)
* Replaced EULA acceptance with data processing consent in setup wizard
* Added link to Privacy Policy in readme
* [Privacy Policy](https://inqyra.com/privacy-policy/)

= 1.1.3 =
* Bundled Transformers.js library locally (removed external CDN dependency)
* Updated smalot/pdfparser to 2.12.4
* Improved file upload sanitization (sanitize_mime_type, absint for all $_FILES fields)
* Improved inline documentation for json_decode sanitization flows
* Escaped SQL identifiers in ALTER TABLE migrations with esc_sql()
* Removed license_key from default settings
* Wrapped Freemius sync cron in premium-only guard

= 1.1.2 =
* Simplified to two tiers: Free and Premium (removed Business tier, renamed Pro to Premium)
* Free version now indexes unlimited pages (post type: pages only)
* Premium adds posts, products, custom post types, documents, synonyms, webhooks, analytics, lead extraction
* Page targeting (show widget on specific pages) is now a Premium feature
* Conversation history: Free shows last 30 days, Premium unlimited
* Full WordPress.org plugin directory compliance
* External services fully documented in readme.txt

= 1.1.2 =
* Fixed all WordPress Plugin Check errors and warnings
* Resolved double $wpdb->prepare() pattern in vector store and RAG engine
* Added phpcs:ignore/disable annotations for all direct database queries on custom tables
* Renamed inq_fs to inqyra_fs for WordPress naming convention compliance

= 1.1.1 =
* Updated Freemius SDK integration settings
* Added plan tier detection helpers for tier-aware feature gating

= 1.1.0 =
* Full WordPress Plugin Check compliance — resolved all PHPCS errors
* Added proper output escaping across all admin templates and service classes
* Added translators comments for all internationalized strings with placeholders
* Ordered all i18n placeholders per WordPress standards
* Replaced inline script with proper wp_enqueue_script for embeddings module
* Added direct file access protection at plugin entry point

= 1.0.9 =
* Updated plugin and author metadata for WordPress.org submission

= 1.0.8 =
* Fixed prompt builder showing model ID instead of AI question (updated deprecated Claude model)
* Added Claude Haiku 4.5 to available models and pricing
* WordPress Plugin Check compliance: resolved all PHPCS errors
* Improved input sanitization and nonce verification across admin
* Gated debug logging behind WP_DEBUG to follow WordPress best practices
* Moved uninstall logic to Freemius after_uninstall hook for proper cleanup
* Used WordPress Filesystem API (wp_delete_file, WP_Filesystem) throughout

= 1.0.7 =
* Initial release
* 5 AI providers: OpenAI, Gemini, Claude, Mistral, DeepSeek
* RAG-powered search with vector, keyword, and title/path matching
* Browser-based embeddings via Transformers.js
* 29-language support with default system prompts
* Customizable floating chat widget
* Auto-recrawl on content changes
* Cost and token tracking with budget limits
* Setup wizard for guided configuration
* Pro: Document upload (PDF, DOCX), synonyms, webhooks, lead extraction, advanced analytics
