Welcome, candidates! This project is a custom-built chatbot application that mimics the functionalities of ChatGPT for personal use. It's built using Python and Django for the backend, and React with Next.js for the frontend. The application offers regular chatting capabilities with history stored in the database, streaming responses, and auto-generated titles using GPT-3.5. It also allows for title editing, conversation deletion, and message regeneration. The project currently supports model selection between GPT-3.5 and GPT-4 and features a custom Django admin page for managing conversations, versions, and messages.
Note: This project is a work in progress, with plans to add more features and functionalities. It serves as a platform to experiment with Next.js and create a personal version of ChatGPT with custom functionalities and features.
- Python
- Django
- Django Rest Framework
- Next.js
- React
- SQLite for now -> will be changed to PostgreSQL
- Regular chatting with history stored in the database, with different versions of conversations created during message regeneration or editing.
- Streaming responses.
- Auto-generated titles using GPT-3.5.
- Title editing for given conversations.
- Deletion of conversations.
- Assistant message regeneration.
- User message editing.
- Model selection: currently GPT-3.5 or GPT-4.
- Custom Django admin page for managing conversations, versions, and messages.
- Setup environment variables in
backend/.env
(create file if not exists):FRONTEND_URL
- URL of frontend app (default: http://127.0.0.1:3000)BACKEND_URL
- URL of backend app (default: http://127.0.0.1:8000)BE_ADMIN_EMAIL
- Email for Django admin page (default: [email protected])BE_ADMIN_PASSWORD
- Password for Django admin page (default: admin)DJANGO_SECRET_KEY
- Django secret key- GPT settings (currently set up for Azure endpoint):
OPENAI_API_TYPE
: azureOPENAI_API_BASE
: your Azure endpointOPENAI_API_VERSION
: your Azure API versionOPENAI_API_KEY
: your Azure API key
- Create a virtual environment and install requirements from
dependencies.txt
- Run
python manage.py makemigrations
andpython manage.py migrate
- Run
python manage.py create_superuser
to create a superuser - Run
python manage.py create_roles
to createuser
andassistant
roles - Run
python manage.py collectstatic
- Run
python manage.py runserver
to start the backend server - Alternatively, run
python server.py
to start with uvicorn
- Setup environment variables in
frontend/.env.local
(create file if not exists):NEXT_PUBLIC_API_BASE_URL
- URL of backend app (default: http://127.0.0.1:8000)
- Run
npm install
- Run
npm run dev
to start the frontend server
Go to http://127.0.0.1:3000
and enjoy!