A Flask-based chatbot that mimics fictional characters' speaking styles using Google's Gemini AI. Users can select a character, and the AI will generate responses while staying in character.
- Allows users to choose a fictional character and its source.
- Maintains conversation history for context-aware responses.
- Uses Google Gemini AI for text generation.
- Stores session data to maintain chat continuity.
- Backend: Flask, Flask-Session
- AI Model: Google Gemini API
- Environment Management: dotenv
- Frontend: HTML/CSS (with Flask rendering)
git clone https://github.com/your-repo/persona-ai-chatbot.git
cd persona-ai-chatbotpython3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`pip install flask flask-session google-generativeai python-dotenvCreate a .env file in the root directory of the project and add the following content:
GEMINI_API_KEY=your_google_gemini_api_key_here
Replace your_google_gemini_api_key_here with your actual Gemini API key.
python app.pyAccess the chatbot at http://127.0.0.1:5000/.
persona-ai-chatbot/
│── env/ # Virtual environment folder
│── templates/ # HTML templates for frontend
│── Persona_AI.py # Main Flask application file
│── .env # Environment variables
│── README.md # Project documentation
- Initializes a new session and sets the character.
- Request:
{ "character": "Yoda", "source": "Star Wars" } - Response:
{ "message": "Character set to Yoda." }
- Sends a message and receives an in-character response.
- Request:
{ "message": "Hello there!" } - Response:
{ "response": "Greetings, young padawan!" }
Feel free to fork this repository and submit pull requests with improvements.