=== Zuczkowski AI Chat Assistant ===
Contributors: katalizatorai
Tags: chatbot, ai, chatgpt, gemini, claude
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

An AI chat widget for your WordPress site - ChatGPT, Gemini, DeepSeek, and Claude. Use your own API key and go live for free.

== Description ==

Zuczkowski AI Chat Assistant adds a floating chat widget to your site that answers visitor questions using the AI model you choose:

* **ChatGPT (OpenAI)**
* **Google Gemini**
* **DeepSeek**
* **Claude (Anthropic)**

The free version is fully functional: paste your own API key for the provider you choose in the settings panel, adjust the system prompt, and the widget is ready.

= Features =

* Choice of 4 AI providers
* Configurable system prompt and reply length limit
* Chat widget inserted automatically, or manually via the `[zuczek_chat_widget]` shortcode
* API keys stored encrypted in the database
* Built-in, basic per-IP rate limiting
* Uses the WordPress REST API (no external JS dependencies)

= Planned Pro add-on =

A separate, paid Pro add-on (sold outside this repository) is in development, for users who need more than the basic free version. Details and feature scope will be announced closer to launch.

This plugin (the free version) works fully on its own and does not require any add-on.

== External services ==

This plugin connects to external AI services to generate replies in the chat widget. The connection happens only when a visitor sends a message through the widget, and only to the provider selected by the administrator in the plugin settings.

Depending on the provider selected, the visitor's message content and the last few messages from the conversation history are sent to:

* **OpenAI** (api.openai.com) - used when ChatGPT is selected as the provider.
  Terms of use: https://openai.com/policies/terms-of-use
  Privacy policy: https://openai.com/policies/privacy-policy

* **Google (Gemini API)** (generativelanguage.googleapis.com) - used when Gemini is selected as the provider.
  Terms of use: https://ai.google.dev/gemini-api/terms
  Privacy policy: https://policies.google.com/privacy

* **DeepSeek** (api.deepseek.com) - used when DeepSeek is selected as the provider.
  Terms of use: https://cdn.deepseek.com/policies/en-US/deepseek-open-platform-terms-of-service.html
  Privacy policy: https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html

* **Anthropic** (api.anthropic.com) - used when Claude is selected as the provider.
  Terms of use: https://www.anthropic.com/legal/consumer-terms
  Privacy policy: https://www.anthropic.com/legal/privacy

The API key needed to connect to the selected provider is supplied by the site administrator (by creating an account with that provider). The plugin does not send any data to any of these services without an active interaction from a visitor with the chat widget.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`, or install it through the "Plugins" screen in WordPress.
2. Activate the plugin.
3. Go to **AI Chat Bot** in the admin sidebar menu.
4. Choose a provider (OpenAI / Gemini / DeepSeek / Claude) and paste the matching API key.
5. Save the settings - the chat widget appears on your site automatically.

== Frequently Asked Questions ==

= Do I need my own API key? =
Yes, in the free version. You get one by creating an account with the provider you choose (OpenAI, Google AI Studio, DeepSeek, or Anthropic/Claude).

= Does the plugin store my conversation data anywhere? =
Not by default - the conversation history only exists in the visitor's browser, for the current session. The administrator can optionally enable a log of recent conversations ("Conversation log" section in settings, disabled by default) - when enabled, the first message and reply from each new conversation, along with the IP address, are saved to the WordPress database, visible to administrators only, capped at 50 entries with automatic cleanup after a set number of days. If you enable this, mention it in your site's privacy policy.

= Can I use more than one bot on my site? =
This (free) version supports one, global bot configuration.

== Changelog ==

= 2.0.1 =
* Renamed all internal function, class, option, and hook names from the `aicb`/`AICB_` prefix to `zuczek`/`ZUCZEK_`, per a WordPress.org review requirement (the old prefix was flagged as too generic/common to safely avoid collisions with other plugins).
* The chat widget shortcode is now `[zuczek_chat_widget]`. Removed the old, unprefixed `[ai_chat_widget]` alias - also flagged as too generic.
* Fixed a race condition in the per-IP and daily message rate limiters: the counters now increment atomically instead of a plain read-then-write, so concurrent requests can no longer slip past the configured limits.

= 2.0.0 =
* Renamed the plugin to "Zuczkowski AI Chat Assistant" (slug: zuczkowski-ai-chat-assistant) to resolve a trademark conflict flagged during the WordPress.org review.
* The chat widget shortcode is now `[aicb_chat_widget]` (prefixed); the old `[ai_chat_widget]` still works as an alias.
* The "Powered by" footer link is now off by default and must be turned on explicitly in settings.
* Moved `load_plugin_textdomain()` to the `init` hook (was `plugins_loaded`).
* Fixed outdated DeepSeek Terms of Use / Privacy Policy links in the External Services disclosure.

= 1.0.9 =
* The chat widget is now hidden from visitors until an API key is configured for the active provider - previously it always appeared once enabled, so visitors could open a chat that immediately replied with an error. Added an admin notice explaining this when no key is set.

= 1.0.8 =
* Added a "Powered by" footer toggle in settings (Widget appearance section), letting you turn off the "Powered by Katalizator AI" link at the bottom of the chat independently of Free/Pro version. Enabled by default.
* Added an optional email notification (Email notifications section, disabled by default) to the WordPress admin address when a visitor starts a new conversation with the bot. Includes a short preview of the first message, throttled to at most one email every 5 minutes.
* Added an optional log of recent conversations (Conversation log section, disabled by default; new "AI Chat Bot → Conversations" screen) - first message and reply per conversation, capped at the 50 most recent entries, automatic cleanup after a set number of days (WP-Cron), a button to clear it permanently. When the log is enabled, the email notification links straight to the logged conversation instead of just the homepage.
* Prepared for submission to the WordPress.org plugin repository: trimmed the short description to the 150-character limit, trimmed tags to 5, filled in `Contributors`, toned down mentions of the not-yet-built Pro version (plugin description, settings panel, FAQ) to avoid listing features that don't exist yet.
* Rewrote the plugin's source strings from Polish to English (the WordPress.org convention), with Polish shipped as a bundled translation (`languages/katalizator-ai-chat-bot-pl_PL.mo`).

= 1.0.7-beta =
* Fixed a double-encryption bug in the API keys: `sanitize_settings()` was hooked as the global `sanitize_option_aicb_settings` filter, which fires on EVERY `update_option()` call on that option, not just when the settings form is submitted. This caused two problems - (1) the "Delete key" button would silently restore the old value instead of actually deleting it, and (2) every "Delete key" or history "Restore" call would re-encrypt the other, already-encrypted provider keys, corrupting them over time. `handle_delete_key()` and `handle_restore_settings()` now temporarily remove this filter before their own `update_option()` call.

= 1.0.6-beta =
* Added the ability to permanently delete a saved API key from the database (a "Delete key" button next to "Test connection" for each provider). The action can be undone via the "Change History" panel.
* Updated the documentation - it was missing mentions of Claude (Anthropic) support, added in the previous version.

= 1.0.5-beta =
* Fixed a stale-security-token risk under long page-cache TTLs (e.g. LiteSpeed Cache) - the widget now fetches a fresh nonce when the chat is opened.

= 1.0.4-beta =
* Removed the download counter (moved to a separate, non-distributed plugin "Katalizator Site Tools" - not a product feature, just a marketing tool for the zuczkowski.com.pl site).

= 1.0.3-beta =
* Added a full LICENSE.txt file (GPLv2) - required before publishing to the WordPress.org repository.

= 1.0.2-beta =
* Switched API key encryption from AES-256-CBC to AES-256-GCM (authenticated encryption), keeping backward compatibility.

= 1.0.0 =
* First release.
