Version ChatGPT 3.5 turbo, 3.5 turbo 0301.
Version GPT 4 has not been tested yet.
➥ Download ZIP or use git command.
➥ Get your OpenAi key - https://platform.openai.com/account/api-keys
➥ Open config.js and fill  const strIndex = "YOUR_API_KEY";
➥ If you want to change path - const path = "/chat"; - change it. For root use const path = "";
➥ If you want to change system_message - const system_message = "You are a smart robot!"; - change it. By changing this setting, you can adapt this application to your needs. 
➥ Make path /chat or any other on your web server.
➥ Upload files to this directory.
➥ Type in the browser your address https://your-website.com/chat/ and enjoy.
➥ Also you can use Obfuscator to hide your api key for security reason.
https://codebeautify.org/javascript-obfuscator
Used frontpage html, js and css from this project (with some mods)
https://github.com/xtekky/chatgpt-clone
Used Javascript Openai api request
https://www.builder.io/blog/stream-ai-javascript
All functions are preserved, except for the web search - instead, a change in theme from dark to light has been made. Added temperature change function. Added context. So GPT remember your last questions.
This program runs on a laptop or desktop computer locally from a folder.
Read this stackoverflow solution
https://stackoverflow.com/questions/38497334/how-to-run-html-file-on-localhost
You can use Node.js or Python server.
How to install app on Pyton:
- Install Pyton - https://www.python.org
 - Сreate a directory 
chat. - Change const path in config.js to 
path = "";. - Change const root in config.js to 
root = ".";( just delete//). - Put index.html and assets files here.
 
cd chatpython -m http.server-  Open in browser 
http://192.168.1.52:8000/ -  Also you can use 
http://127.0.0.1:8000/ - Or this address 
http:/localhost:8000/ 
Use app on your local computer.
Last update - added convertations.
 
Removed all php files.
Changed path for assets files.

