This is a chatbot created using the OpenAI API, Flask and MySQL
| Dependency | Documentation | MacOS Installation |
|---|---|---|
| Venv | https://docs.python.org/3/library/venv.html | https://formulae.brew.sh/formula/virtualenv |
| Python 3.7 | https://docs.python.org/3.7/ | https://www.python.org/downloads/release/python-370/ |
| MySQL | https://dev.mysql.com/doc/ | https://formulae.brew.sh/formula/mysql |
brew update
brew isntall pyenv
pyenv install 3.7
pyenv shell 3.7Useful links:
pip3 install virtualenv- or
brew install virtualenvUseful link:
brew install mysqlUseful link:
- Create the virtual environment using python 3.7
python -m venv .env- On MacOS (Option 1)
source env/bin/activate- On Windows
venv\Scripts\activate.bat- On MacOS (Option 2), Linux or Windows Git Bash
source venv/Scripts/activatedeactivatepip install -r requirements.txtUsed for users management and chat recording
brew services start mysql- To stop it
brew services stop mysqlmysql -u root- To get out from mysql
quit();create database chatbot;use chatbotCREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;CREATE TABLE `chats` (
`id` varchar(100) NOT NULL,
`question` varchar(255) NOT NULL,
`answer` LONGTEXT NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_DB=chatbot
SECRET_KEY=<Any random string>
API_KEY=<Your OpenAI API for gpt-3.5-turbo key>
python3 main.pyGo to your web browser and open your localhost:4000.
Enjoy it!