Swastik AI is a Flask-based AI chat web application with user authentication, chat session storage, and support for multiple AI providers.
- User registration and login with password hashing
- Persistent chat sessions and message history using PostgreSQL
- Multi-model AI routing across Gemini, Groq, SambaNova, and GitHub-hosted models
- Simple command handling for opening common websites from chat input
- Single-page web interface served by Flask
- Python
- Flask
- Flask-CORS
- Flask-SQLAlchemy
- Flask-Bcrypt
- PostgreSQL
- OpenAI SDK (for compatible providers)
- Google Generative AI SDK
- Gunicorn
app.py- Main Flask application, API routes, model routing, and database modelsswastik_f.html- Frontend UI templaterequirements.txt- Python dependencies
GET /- Loads the web interfacePOST /register- Creates a new user accountPOST /login- Authenticates an existing userPOST /agent- Processes user input and returns model or system-command responses
Set these in a .env file or environment:
DB_PASSWORD- PostgreSQL passwordDB_PORT- PostgreSQL portGEMINI_API_KEY- Google Gemini API keyGROQ_API_KEY- Groq API keySAMBANOVA_KEY- SambaNova API keyGITHUB_TOKEN- GitHub models inference tokenMISTRAL_KEY- Mistral API keyHF_TOKEN- Hugging Face token
- Clone the repository.
- Create and activate a Python virtual environment.
- Install dependencies:
pip install -r requirements.txt- Ensure PostgreSQL is running.
- Create the required database. The app currently expects the database name
swastik_databecause it is hardcoded inapp.py.
createdb swastik_data- Configure environment variables.
- Start the app:
python app.pyThe application runs on http://localhost:5001 by default.
- Database tables are created automatically at startup using
db.create_all()once the PostgreSQL database exists. - In development mode, Flask debug is enabled in
app.py. - Never enable debug mode in production because it can expose sensitive data and remote code execution paths through the debugger.
- For production, use Gunicorn with debug disabled.