A Django-based chat application that uses OpenAI's GPT-3.5-turbo model to provide intelligent responses.
- Modern, responsive chat interface
- OpenAI GPT-3.5-turbo integration
- Real-time message handling
- Mobile-friendly design
- Chat history sidebar
pip install -r requirements.txt- Get your OpenAI API key from https://platform.openai.com/api-keys
- Create a
.envfile in the project root with your API key:
OPENAI_API_KEY=your_actual_api_key_here
python manage.py migratepython manage.py runserverOpen your browser and go to http://localhost:8000/chat/
The application uses the following OpenAI API settings:
- Model:
gpt-3.5-turbo - Max tokens: 150
- Temperature: 0.7
You can modify these settings in the generate_bot_response function in chat/views.py.
cvbot/
├── chat/ # Main chat application
│ ├── models.py # Database models
│ ├── views.py # View functions including OpenAI integration
│ ├── urls.py # URL routing
│ └── templates/ # HTML templates
├── cvbot/ # Django project settings
│ ├── settings.py # Project configuration
│ └── urls.py # Main URL routing
├── requirements.txt # Python dependencies
└── manage.py # Django management script
- "OPENAI_API_KEY not found": Make sure you've created the
.envfile with your API key - Authentication errors: Verify your OpenAI API key is correct and has sufficient credits
- Rate limit errors: The API has usage limits; wait a moment and try again
- Never commit your
.envfile to version control - Keep your OpenAI API key secure and don't share it publicly
- Consider using environment variables in production deployments