=== Jays Chat Assistant ===
Contributors: jasonrusso
Tags: chatbot, ai chatbot
Requires at least: 5.8
Tested up to: 6.8
Stable tag: 1.1.0
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
A chatbot assistant using the Google Gemini AI platform.

== Description ==
Jay's Chat Assistant is a WordPress plugin designed to integrate AI-powered chatbot functionality into your website for generating leads for your business. You can index your website content so that the bot generates relevant content. You can instruct it to gather information like name, email address that will be emailed to an email address of your choosing. The plugin also includes caching mechanisms to optimize performance and reduce redundant API calls.


== Installation ==

Upload Jays Chat Assistant and activate it. Once activated:

* Get your Google Gemini API key from https://aistudio.google.com/
* Go to Jays Chat Options in your WordPress Admin
* Enter your API Key 
* Welcome Messages (optional) - enter a series of intro questions you want to ask the visitor (one per line)
* Chatbot System Instructions - enter in prompt instructions on how you want the bot to interact with the visitor. 
* Search Results Message (optional) - when the bot searches your site and finds information you can tell it what / how to say it "Here's what I found"
* Admin email - at end of conversation or nightly conversations will get emailed to you. Select where you want them to go.
* Assistant Icon - select the icon you want to show in your chatbot assistant
* Content types - select which content types you want to index that the bot will be able to search
* Store Session Time - configure how long (in hours) conversation data is stored before automatic deletion

Documentation and Examples: [JAYSCHATASSIST](https://thescriptcenter.com/jays-chat-assistant/ 'Jays Chat Assistant') 


== Changelog ==

#### 1.0.10 / 2025-08-13
* Added better error checking for upgrades. 
* Added Template system to choose from a few different styles. Added templates to admin area with 3 templates to choose from.
* Added error correction if for some reason the response text ends up being null it will break the session (if the user comes back). Check for this and unset that array value
* Added first run variable with existing sessions so it can welcome the user back.
* Added more error checking to see if we exceeded max tokens or if there's an error with the API.

#### 1.0.9 / 2025-07-18
* Added click to copy shortcode in the manage bots area.
* Added 3 basic template examples that a user can automatically add to help get them started.

#### 1.0.8 / 2025-07-08
* Added multibot functionality and managment. 
* shortcode parameters to include bot_id and bot_name
* Enhanced bot configuration logic to use bot-specific settings
* Maintained backward compatibility with existing conversations
* Automated slug for bot creation and edit functions
* Added hyperlinks to the chat window responses. Added <strong> and <em> to responses.

#### 1.0.7 / 2025-06-25
* Fixed bug where scrollbar sometimes doesn't initiate. 
* Added option excerpt_word_count option for how many words to store in the embedded content. If we are always searching the site we will want more words to be stored.
* Added option to search the site more than once depending on your system instructions. If you put "search the site" or "search the website" in your instructions it will search every time to find results.
* Added error checking to cosine similarity function in case of timeout or incorrect / invalid data sent to it. 
* Export conversations via csv 
* Adjusted threshold to 0.6 for relevancy search
* Add post title to embedded content. 
* Added update embbeded content on post save.
* Added instructions to send a custom welcome message if none were defined. 

#### 1.0.6 / 2025-06-23
* Added configurable Store Session Time setting allowing users to set how long conversation data is stored (1-8760 hours)
* Updated all session cleanup functions to use the configurable time instead of hardcoded 24 hours
* Added utility function jays_chat_assistant_get_store_session_time() for consistent session time retrieval
* Improved validation and sanitization for the new session time setting

#### 1.0.5 / 2025-06-11
* Fixing security issues esc_attr, esc_html 
* Changed curl to wp_remote_get
* Created admin css and fixed progress bar
* Removed allowing for indexing system/internal post types like attachment, revision, nav_menu_item etc.

#### 1.0.4 / 2025-05-17
* fixed overflow issue in the textarea in chrome. removed "assistant" hard coded h1
* Fixed issue with API key not saving on the first run. 

#### 1.0.3 / 2025-05-13
* Fixed text field width/height adjustments, fixed autoheight on load chrome
* Added close session command. If the bot sends specific words it will trigger an email and close session
* Added cron job for emailing reports, deleting sessions
* Added args to the shortcode. position, bottom, width, height
* removed linebreak onEnter event for textfield area
* fixed major bug in shortcode. changed to a return statement instead of directly printing on screen. allows for shift/enter key to be used for line break.

#### 1.0.2 / 2025-04-25
* Fixed date format in message window
* Restructured Site search format. Added variable to wait to search again.
* Added Gemini Model Options, 1.5 Flash, 1.5 Pro, 2.0 Flash
* Added onEnter event for chat. changed to input text. 