=== Chatbot Local ===
Contributors: jrmora
Tags: chatbot, local, search, assistant, keyword-search
Requires at least: 6.0
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
Donate link: https://jrmora.com/

Lightweight, privacy-first local chatbot based on custom keyword rules.
No third-party APIs required. Completely self-hosted and privacy-focused.

== Description ==

A lightweight, high-performance local chatbot plugin that provides automated instant responses to visitor queries using simple keyword matching rules.
**Chatbot Local** is designed for site owners, creators, and developers who want to offer immediate contextual help or answer frequently asked questions on their WordPress site—without relying on heavy, paid external AI services, tracking scripts, or third-party APIs.

Unlike complex AI integrations that slow down page loads and process private user interactions on remote servers, Chatbot Local operates 100% locally on your WordPress installation.

Assets (CSS and JS) are strictly loaded only on pages where the shortcode is present, keeping your site fast and optimized.

**Key Features:**

* **100% Privacy-First & Local:** No external API keys, no tracking, and no external requests. All interactions stay on your server.
* **Conditional Asset Loading:** Styles and scripts are registered and only enqueued on pages where the `[chatbot_local]` shortcode is actively used.
* **Custom Knowledge Base:** Easily define keyword rules (`tags`) and corresponding responses (`res`) in standard JSON format right from the admin panel.
* **Smart Link Conversion:** Automatically detects plain URLs starting with `http://` or `https://` inside bot responses and turns them into clean, clickable HTML links.
* **REST API Logging System:** Uses a native, secure WordPress REST API endpoint to capture visitor queries for admin review without third-party dependencies.
* **Admin Dashboard & Log Management:** View recent query logs, track answered vs. unanswered questions, paginate logs, or perform bulk deletions with ease.
* **Shortcode Tracker:** The admin dashboard automatically scans your database and lists all published posts or pages currently embedding the chatbot shortcode.
* **Custom Styling & Themes:** Easily switch between Light and Dark visual themes, or customize header, button, and user message bubble colors directly from the settings.
* **Clean Uninstall Option:** Includes an opt-in setting to completely purge all database tables, option fields, and rules upon plugin deletion, leaving zero database bloat behind.

== Installation ==

1. Upload the `chatbot-local` folder to the `/wp-content/plugins/` directory, or upload the `.zip` file directly through the WordPress admin dashboard via **Plugins > Add New > Upload**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **Chatbot Local** in your admin menu to configure messages, styling, and your knowledge base.
4. Insert the `[chatbot_local]` shortcode into any page, post, or widget where you want the assistant to appear.

== Frequently Asked Questions ==

= Does this plugin rely on external AI services like OpenAI or ChatGPT? =
No. Chatbot Local is completely self-contained and operates purely on rule-based keyword matching configured locally inside your WordPress admin dashboard.

= Does it slow down my website? =
No. Chatbot Local is built for performance. Its JavaScript and CSS assets are enqueued strictly on pages where the `[chatbot_local]` shortcode is embedded, avoiding unnecessary bloat across the rest of your site.

= Does it create a custom database table? =
Yes. The plugin creates a lightweight custom table (`wp_chatbot_logs`) to record query logs securely via the WordPress REST API. If you enable the "Complete Cleanup" option in the admin panel, this table and all plugin settings are automatically dropped upon deletion.

= Can visitors ask questions in natural language? =
Yes. The search algorithm normalizes inputs (stripping accents and converting text to lowercase) and searches for keyword matches specified in your JSON knowledge base.

== Screenshots ==

1. Frontend appearance of the chatbot interface with a active conversation flow.
2. Centralized Admin Dashboard displaying general message settings, theme controls, and shortcode implementation tracking.
3. Knowledge Base configuration área and structure examples.
4. Recent Query Logs table with pagination, bulk deletion, and answer status tracking.

== Changelog ==

= 1.0.0 =
* Initial official release.
* Added rule-based keyword matching algorithm in localized vanilla JavaScript.
* Added `[chatbot_local]` shortcode with conditional asset loading.
* Implemented secure REST API logging system to track answered (`matched`) and unanswered (`unmatched`) user queries.
* Added Admin Dashboard with JSON rule editor, theme customization (Light/Dark), and customizable colors.
* Added shortcode detector listing active pages embedding the chatbot.
* Added log management with pagination, bulk deletion, and translation support.
* Added clean uninstall routine option.

== Upgrade Notice ==

= 1.0.0 =
* Initial official release.

== Copyright ==

Chatbot Local is distributed under the terms of the GNU GPL v2 or later.