Go back home

Simple AI Chat - Documentation - by MP Vision


Thank you for purchasing this plugin. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thank you!

Server requirements
Installation process

Please follow these simple steps, your script will be up and running in 5 minutes.

1 - Files : Copy files to your server / localhost

These are all the files you need to import in your project, you can also pick only the logic and do whatever you want in your projet

            SIMPLE-AI-CHAT/
            ├── logic/
            │   ├── chat-config.php
            │   ├── chat-database.php
            │   ├── chat-gpt-api.php
            │   ├── chat-utils.php
            └── src/
            │   ├── css/
            │   │   ├── lightbox.css
            │   │   ├── style.css
            │   ├── img/
            │   │   ├── android-chrome-192x192.png
            │   │   ├── android-chrome-512x512.png
            │   │   ├── apple-touch-icon.png
            │   │   ├── close.png
            │   │   ├── favicon.ico
            │   │   ├── favicon-16x16.png
            │   │   ├── favicon-32x32.png
            │   │   ├── loading.gif
            │   │   ├── logo-inline.png
            │   │   ├── next.png
            │   ├── js/
            │   │   ├── favorites.js
            │   │   ├── index.js
            │   │   ├── lightbox.js
            │   │   ├── settings.js
            │   │   ├── utils.js
            └── vendor/
            │   ├── composer/
            │   ├── league/
            │   ├── orhanerday/
            │   ├── sergeytsalkov/
            │   ├── autoload.php
            └── views/
            │   ├── footer.php
            │   ├── fragment-chat.php
            │   ├── fragment-chat-line.php
            │   └── fragment-chat-line-favorite.php
            │   └── fragment-chat-line-right.php
            │   └── header.php
            │   └── navbar.php
            ├── .htaccess
            ├── composer.json
            ├── composer.lock
            ├── favorites.php
            ├── index.php
            ├── settings.php
        

This script has 3 main pages

index.php: which is the page allowing to send requests to the API for the generation of textual answers or images
settings.php: This page allows you to configure your access to the API and also configure your requests
favorites.php: This page allows you to directly access the list of your favorite queries for faster access


Packages

2 - Database : Create a database / Import .sql file

In the package folder you will find a file simple-ai-chat.sql.
Please go to you server mysql admin, create a new database with the name of your choice and import the .sql file. There are only 3 tables
If the insert succeeded please go to the settings section.
In the other case you can try to copy the content or the .sql file and paste it (phpMyAdmin exemple below) in a new sql query tab

exemple-phpmyadmin

3 - Settings

To enable your API please go to settings first to provide an API Key (if not provided you will be redirected automatically to settings page).
Go to : https://beta.openai.com/account/api-keys to create an API Key and follow instructions.

Once this is done please paste it in the correct field as below
settings-screenshot


Configure you root path and url

EXT_PATH If you install the script not at the root path of your server you need to specify the extention path from the root path :
ex : http://yourservername.com/your/custom/path (EXT_PATH = your/custom/path)

BASE_URL Please define the root url for your script
ex : http://yourservername.com/ (by default EXT_PATH is added at the end)

Connect your database

Go to the file chat-config.php and fill the constant :

Then you are ready to go !

Congratulations

Enable URL Mod Rewriting (Optionnal)

mod_rewrite is an Apache HTTP Server module that provides a rule-based rewriting engine to manipulate URLs before they are sent to the server. It is commonly used for URL rewriting to clean up URLs, improve user experience, and increase security.

To enable mod_rewrite on an Apache server, follow these steps:
Check if mod_rewrite is installed on your server. You can do this by looking for the following line in your Apache configuration file (usually located at /etc/httpd/conf/httpd.conf): LoadModule rewrite_module modules/mod_rewrite.so

If mod_rewrite is installed, you need to allow the usage of the mod_rewrite module in the Apache configuration file.
You can do this by adding the following code to your configuration file:

            < Directory"/var/www/html">
                AllowOverride All
            < /Directory>

Restart Apache after making changes to the configuration file:
sudo systemctl restart httpd

Then with the .htaccess file located in the project folder root directory all should work properly
Note: The exact steps for enabling mod_rewrite may vary depending on your Apache version and operating system.