Skip to content

Trishanjit25/chatboy-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Chat Boy - AI Chatbot

Chat Boy is an intelligent AI-powered chatbot web application built with FastAPI and integrated with OpenRouter's AI models. It provides a modern, responsive chat interface with smooth animations and a delightful user experience. Link https://chatboy-ai.onrender.com

Chat Boy Python FastAPI License

✨ Features

  • πŸ€– AI-Powered Responses: Leverages Google Gemma-3-4b-it model via OpenRouter API
  • 🎨 Modern UI: Glassmorphism design with smooth animations and particle effects
  • β™Ώ Accessibility First: WCAG compliant with screen reader support, keyboard navigation, and reduced motion options
  • ⚑ Real-time Chat: Instant AI responses with typing indicators and character-by-character animation
  • πŸ“± Responsive Design: Mobile-first approach with adaptive layouts
  • πŸ”’ Secure: Environment variable configuration for API keys
  • πŸŒ™ Dark Mode: Enhanced dark theme with high contrast support
  • πŸ“‹ Message Features:
    • Copy messages to clipboard
    • Timestamps for each message
    • Character counter (2000 limit)
    • Auto-resizing textarea
  • ⌨️ Keyboard Shortcuts:
    • Enter - Send message
    • Ctrl+Enter - New line
    • Escape - Clear input
  • πŸ”” User Feedback:
    • Toast notifications for actions
    • Scroll indicator for long conversations
    • Idle status indicator
    • Loading states and error handling

πŸ› οΈ Tech Stack

  • Backend: FastAPI - Modern Python web framework
  • AI Integration: OpenRouter - Unified API for AI models
  • Frontend: HTML5, CSS3, JavaScript (Vanilla)
  • Templating: Jinja2
  • Deployment Ready: Compatible with Render, Heroku, and other platforms

πŸ“‹ Prerequisites

  • Python 3.11 or higher
  • OpenRouter API Key

πŸš€ Installation

  1. Clone the repository
bash
   git clone https://github.com/yourusername/chatboy.git
   cd chatboy
   
  1. Create a virtual environment
bash
   python -m venv venv
   source venv/bin/activate  # On Windows: venv\Scripts\activate
   
  1. Install dependencies
bash
   pip install -r requirements.txt
   
  1. Configure environment variables

    Create a .env file in root directory (this file is already in .gitignore for security):

   # OpenRouter API Configuration
   OPENROUTER_API_KEY=your_openrouter_api_key_here
   
   # Application Configuration
   APP_NAME=ChatBoy AI
   APP_VERSION=1.0.0
   DEBUG=false

πŸ” Security Note: Get your free API key from OpenRouter

The .env file is automatically excluded from git commits to protect your API keys.

  1. Run the application
bash
   uvicorn app:app --reload
   
  1. Open your browser Navigate to http://localhost:8000

πŸ“ Project Structure

chatboy/
β”œβ”€β”€ app.py                 # Main FastAPI application
β”œβ”€β”€ lim.py                # Standalone CLI version (optional)
β”œβ”€β”€ requirements.txt      # Python dependencies
β”œβ”€β”€ .env                  # Environment variables (not in git)
β”œβ”€β”€ .gitignore           # Git ignore rules
β”œβ”€β”€ TODO.md              # Development roadmap
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ style.css        # Modern CSS with glassmorphism
β”‚   └── animations.js    # Client-side animations
└── templates/
    β”œβ”€β”€ index.html       # Main chat interface
    └── about.html       # About page

πŸ”§ API Endpoints

Method Endpoint Description
GET / Main chat page
GET /about About page
GET /health Health check
GET /ai?prompt={text} AI chat endpoint
POST /items/ Create item (demo)
GET /items/{id} Get item (demo)

🎨 UI Features

Glassmorphism Design

  • Translucent chat container with backdrop blur
  • Frosted glass effects on header and input areas
  • Subtle blur backgrounds with particle animations
  • Floating shapes for visual depth

Advanced Animations

  • Smooth message slide-in effects with staggered timing
  • Typing indicator with animated dots
  • Button hover effects with shimmer animations
  • Toast notification animations
  • Particle background with connected nodes
  • Robot icon floating animation

Responsive & Adaptive Layout

  • Mobile-first design approach
  • Adaptive chat container for all screen sizes
  • Touch-friendly buttons and inputs
  • Flexible input area on mobile devices
  • Optimized typography scaling

πŸ” Security & Best Practices

Environment Variables

  • βœ… API keys are stored in .env file (never committed to git)
  • βœ… .env is included in .gitignore by default
  • βœ… Use .env.example as a template for required variables

Production Security

  • πŸ”’ Use environment-specific secret management (AWS Secrets Manager, etc.)
  • πŸ”’ Enable HTTPS in production
  • πŸ”’ Implement rate limiting
  • πŸ”’ Add CORS configuration as needed

Accessibility Features

  • 🎯 WCAG 2.1 AA compliant
  • 🎯 Screen reader support with ARIA labels
  • 🎯 Keyboard navigation support
  • 🎯 High contrast mode support
  • 🎯 Reduced motion support for users with vestibular disorders
  • 🎯 Skip links for keyboard users

πŸ§ͺ Testing

bash
# Run the development server
uvicorn app:app --reload

# Test health endpoint
curl http://localhost:8000/health

# Test AI endpoint
curl "http://localhost:8000/ai?prompt=Hello"

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ› Known Issues

  • Emoji picker and voice input are planned features (not yet implemented)
  • Rate limits depend on OpenRouter API tier

πŸ“ˆ Future Enhancements

  • Voice input support
  • Emoji picker
  • Chat history persistence
  • Multiple AI model selection
  • User authentication
  • Real-time WebSocket updates

Made with ❀️ using FastAPI

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors