=== Kailin AI Bot ===
Contributors: shcd
Tags: ai chatbot, chatbot, openrouter, persian chatbot, rtl
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.0.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI chatbot for WordPress with custom training, chat logs, RTL support, and integrations for OpenRouter, Ollama, and Cloudflare Workers AI.

== Description ==

Kailin AI Bot is a WordPress chatbot plugin designed for Persian and RTL websites, support teams, online stores, educational websites, and service-based businesses.

The plugin adds a responsive chat widget to the front-end and a modern management panel to the WordPress dashboard. Site administrators can train the chatbot with custom question-and-answer content, upload training files, view user conversations, and connect the assistant to supported AI providers.

= Main Features =

* Responsive front-end chatbot widget
* RTL-ready interface for Persian websites
* Light, dark, and colorful chat themes
* Custom chatbot tone selection
* Custom training with question-and-answer entries
* Import training content from PDF, DOCX, TXT, CSV, XLS, and XLSX files
* Paginated training list for better performance
* User chat log viewer with pagination
* Delete single or multiple training entries
* Delete chat records from the dashboard
* Stores chat messages in custom database tables
* Stores visitor IP address with chat records
* Tehran time support with Jalali date display
* OpenRouter integration
* Ollama integration
* Cloudflare Workers AI integration
* Host compatibility and PHP module status screen
* REST API communication through WordPress
* Custom table prefix using SHCD_ tables
* InnoDB table creation when supported
* Database handling through the WordPress $wpdb API

= AI Providers =

Kailin AI Bot can connect to different AI providers. The site administrator chooses the active provider from the plugin settings.

* OpenRouter
* Ollama
* Cloudflare Workers AI

The plugin sends user messages and the selected conversation context to the chosen provider in order to generate responses. API keys and access tokens are saved in the WordPress database and are not printed in the public front-end.

= Custom Training =

Administrators can add training content manually or import it from supported files. The plugin can store structured question-and-answer content and use it as the knowledge base for chatbot responses.

Supported import formats:

* PDF
* DOCX
* TXT
* CSV
* XLS
* XLSX

File parsing quality depends on the source file. Scanned PDFs or image-based documents may require manual text correction before import.

= Privacy =

This plugin can store chat messages, assistant responses, session identifiers, visitor IP addresses, selected AI provider names, model names, and message timestamps in custom WordPress database tables.

If you use this plugin on a public website, you should update your privacy policy and inform visitors that their chat messages may be stored and may be sent to the selected AI provider for response generation.

= Third-Party Services =

This plugin can connect to third-party AI services only when the site administrator enters the required credentials and enables the provider.

OpenRouter:
* Service URL: https://openrouter.ai
* Documentation: https://openrouter.ai/docs
* Privacy Policy: https://openrouter.ai/privacy
* Terms: https://openrouter.ai/terms

Ollama:
* Service URL: https://ollama.com
* Documentation: https://docs.ollama.com
* Privacy Policy: https://ollama.com/privacy
* Terms: https://ollama.com/terms

Cloudflare Workers AI:
* Service URL: https://developers.cloudflare.com/workers-ai/
* Documentation: https://developers.cloudflare.com/workers-ai/
* Privacy Policy: https://www.cloudflare.com/privacypolicy/
* Terms: https://www.cloudflare.com/terms/

When a provider is enabled, the plugin may send the visitor message, conversation context, and configured model information to that provider. The data sent depends on the active provider and plugin settings.

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the ZIP file through **Plugins > Add New > Upload Plugin**.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Open the **Kailin AI Bot** menu in the WordPress dashboard.
4. Select your preferred AI provider.
5. Enter the required API key, token, model name, or local service address.
6. Add your first training entry or import a supported training file.
7. Open your website front-end and test the chatbot widget.

== Frequently Asked Questions ==

= Does Kailin AI Bot work without an AI provider? =

The plugin can store training content and chat records locally, but AI-generated responses require at least one supported AI provider to be configured.

= Does the plugin expose API keys in the browser? =

No. Provider credentials are used from the server side and are not printed in the public chat widget.

= Can I use Ollama on shared hosting? =

Only if the WordPress server can access the Ollama service URL. If Ollama is running on your personal computer, a hosted WordPress website cannot access `localhost` on that computer.

= Does the plugin support Persian and RTL websites? =

Yes. The dashboard and front-end widget are built for RTL layouts and Persian websites.

= Can I import scanned PDF files? =

Scanned or image-based PDF files may not contain selectable text. In that case, you should extract the text with OCR first or enter the training content manually.

= Where are chat messages stored? =

Messages are stored in the plugin custom database tables, including the SHCD_ai_chatbot_messages table with the active WordPress database prefix.

= Does the plugin store IP addresses? =

Yes. The plugin can store visitor IP addresses with chat records for management, security, and reporting purposes.

= Can I delete stored chats? =

Yes. The dashboard includes chat log management with pagination and delete options.

== Screenshots ==

1. Chatbot widget on the front-end.
2. AI provider settings screen.
3. Custom training management screen.
4. Chat logs with pagination.
5. Host compatibility and database status screen.
6. Chat widget theme settings.

== Changelog ==

= 1.0.0 =
* Initial public release.
* Added responsive chatbot widget.
* Added Persian and RTL-friendly interface.
* Added custom training management.
* Added file import for PDF, DOCX, TXT, CSV, XLS, and XLSX.
* Added OpenRouter integration.
* Added Ollama integration.
* Added Cloudflare Workers AI integration.
* Added chat logs with pagination.
* Added visitor IP storage for chat records.
* Added Jalali date display and Tehran time support.
* Added host compatibility screen.
* Added custom SHCD_ database tables.
* Added GPLv2 or later license declaration.

== Upgrade Notice ==

= 1.0.0 =
Initial public release of Kailin AI Bot.
