Skip to content

atilavahedian/TurnIn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ TurnIn - Automated Assignment Completion System

This repository is licensed under a proprietary license. See LICENSE.

TurnIn is a revolutionary Django-based system that automates student assignments using AI agents and Browser Use technology. It provides a seamless, intelligent solution for completing academic work through advanced browser automation.

โœจ Features

  • ๐Ÿค– AI-Powered Assignment Completion: Automatically completes assignments using advanced AI models (GPT-4, Claude, etc.)
  • ๐ŸŒ Browser Use Integration: Real-time browser automation using the Browser Use library
  • ๐Ÿ“บ Live Browser Monitoring: Watch the AI agent complete assignments in real-time
  • ๐Ÿง  Multiple AI Models: Support for OpenAI, Anthropic, Google, and DeepSeek models
  • โšก WebSocket Support: Real-time updates and live monitoring
  • ๐Ÿ‘ฅ User Management: Secure user authentication and credential management
  • ๐Ÿ“Š Admin Interface: Complete admin dashboard for monitoring and management

๐ŸŽฏ How It Works

  1. ๐Ÿ’ฌ Natural Conversation: Students chat with the AI assistant about their assignment
  2. ๐Ÿ” Smart Requirements Gathering: The assistant naturally asks follow-up questions to understand:
    • Assignment type (essay, presentation, research, etc.)
    • Platform to use (Google Docs, Slides, Canvas, etc.)
    • Topic and specific requirements
    • Login credentials (username/password)
  3. ๐Ÿš€ Automatic Trigger: When enough information is gathered, automation starts seamlessly
  4. ๐ŸŒ Browser Automation: Browser Use agent logs in and completes the assignment
  5. ๐Ÿ“ฑ Real-time Monitoring: Watch the AI work through live browser streaming
  6. โœ… Completion: Assignment is saved/submitted automatically

Example Conversation:

User: "I need help with my history assignment"
Assistant: "I'd love to help! What type of assignment is it and what's the topic?"
User: "It's a 10-slide presentation about the Irish Potato Famine for Google Slides"
Assistant: "Perfect! I'll need your Google account to create the slides. What are your login credentials?"
User: "username: student@iusd.org, password: mypassword123"
Assistant: "๐Ÿš€ Perfect! I have everything I need. Starting the automation now - you can watch the progress in real-time!"
[Automation begins automatically]

๐Ÿš€ Quick Start

1. Installation

# Activate virtual environment (already created)
source venv/bin/activate

# Install dependencies (already done)
pip install -r requirements.txt

# Install Playwright browsers (already done)
playwright install chromium

2. Configuration

IMPORTANT: Create a .env file in the project root with your API keys:

# AI Provider API Keys (REQUIRED for automation)
# At minimum, you need OPENAI_API_KEY for the system to work
OPENAI_API_KEY=sk-your-actual-openai-key-here

# Optional: Other AI providers
ANTHROPIC_API_KEY=your-anthropic-api-key-here
GOOGLE_API_KEY=your-google-api-key-here
DEEPSEEK_API_KEY=your-deepseek-api-key-here

# Optional: Browser Use Cloud (for remote automation)
BROWSER_USE_CLOUD_API_KEY=your-browser-use-cloud-key-here

# Django Configuration
SECRET_KEY=django-insecure-change-this-key-in-production
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1

# Browser Use Configuration
BROWSER_USE_HEADLESS=False
BROWSER_USE_TIMEOUT=300
BROWSER_USE_SCREENSHOT_QUALITY=90

# IUSD Configuration
IUSD_LOGIN_URL=https://iusd.k12.ca.us/login
ALLOWED_DOMAINS=iusd.k12.ca.us,google.com,classroom.google.com

3. Database Setup (Already Done)

# Migrations already created and applied
python manage.py makemigrations
python manage.py migrate

# Superuser already created (admin/admin123)
python manage.py createsuperuser

4. Start the Server

python manage.py runserver

Visit http://localhost:8000 to access the application!

2.1 Email delivery (SMTP)

To send real emails, add SMTP settings to your .env (dotenv is loaded by turnin/settings.py). Example:

EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_USE_SSL=False
EMAIL_HOST_USER=your_email@yourdomain.com
EMAIL_HOST_PASSWORD=your_app_password_or_smtp_key
DEFAULT_FROM_EMAIL="Turnin <no-reply@yourdomain.com>"
SERVER_EMAIL="Turnin Server <server@yourdomain.com>"

Notes:

  • Use only one of EMAIL_USE_TLS or EMAIL_USE_SSL.
  • For Gmail/Workspace, use an App Password (with 2FA) or SMTP relay โ€” normal account password wonโ€™t work.
  • In DEBUG, the default backend is the console backend (prints emails to terminal). Override EMAIL_BACKEND to SMTP to actually send.

Test delivery:

python manage.py sendtestemail you@example.com

If you receive the message, SMTP is working.

๐ŸŽฎ Usage Guide

For Students

  1. ๐ŸŒ Access the Website: Open http://localhost:8000 in your browser
  2. ๐Ÿ’ฌ Chat Interface: Use the chat interface to describe your assignment
  3. ๐Ÿš€ Start Automation: Click "Start Automation" when prompted
  4. ๐Ÿ“ Fill Task Form: Enter your assignment details and IUSD credentials
  5. ๐Ÿ‘€ Live Browser: Watch the AI agent work in the live browser window
  6. ๐Ÿ“Š Monitor Progress: Track task completion in real-time

For Administrators

  1. ๐Ÿ”ง Admin Panel: Access http://localhost:8000/admin (username: admin, password: admin123)
  2. ๐Ÿ“Š Monitor Tasks: View all automation tasks and their statuses
  3. ๐Ÿ‘ฅ Manage Users: Handle user accounts and profiles
  4. ๐Ÿ“‹ View Logs: Check system logs for debugging and monitoring
  5. โš™๏ธ System Settings: Configure system-wide settings and preferences

๐Ÿ—๏ธ Architecture

The system consists of several key components:

  • ๐Ÿข Django Backend: Main application server and REST API
  • ๐Ÿค– Browser Use Service: Handles browser automation and AI agent management
  • โšก WebSocket Consumers: Real-time updates for live monitoring
  • ๐Ÿ“‹ Task Management: Async task processing and queue management
  • ๐Ÿ“Š Admin Interface: Management dashboard for monitoring and control

๐Ÿ“Š Database Models

  • ๐Ÿ‘ค UserProfile: Extended user information and preferences
  • ๐ŸŒ BrowserSession: Browser automation session tracking
  • ๐Ÿ“‹ AutomationTask: Individual task records and metadata
  • ๐Ÿ‘ฃ TaskStep: Detailed step-by-step execution logs
  • ๐Ÿ“Š TaskResult: Final results and outcomes
  • ๐Ÿ“ SystemLog: System-wide logging and debugging

๐Ÿ”Œ API Endpoints

Task Management

  • POST /api/tasks/create/: Create new automation task
  • GET /api/tasks/: List user's tasks
  • GET /api/tasks/{id}/: Get task status and details
  • POST /api/tasks/{id}/cancel/: Cancel running task
  • GET /api/tasks/{id}/result/: Get task results

User Management

  • POST /api/credentials/: Save user credentials
  • GET /api/logs/: Get system logs (admin only)

WebSocket Endpoints

  • ws/task/{task_id}/: Real-time task updates
  • ws/browser/{session_id}/: Browser session monitoring

๐Ÿ›ก๏ธ Security Features

  • ๐Ÿ” Secure Authentication: User credentials are stored securely
  • ๐Ÿ”‘ API Key Management: All API keys stored in environment variables
  • ๐Ÿ”’ WebSocket Security: Authenticated WebSocket connections
  • ๐Ÿ‘ฎ Admin Protection: Admin access restricted to superusers
  • ๐Ÿ›ก๏ธ API Security: All endpoints require proper authentication

๐Ÿ“ Project Structure

turnin/
โ”œโ”€โ”€ turnin/                 # Django project settings
โ”‚   โ”œโ”€โ”€ settings.py        # Updated with Browser Use config
โ”‚   โ”œโ”€โ”€ urls.py           # URL routing
โ”‚   โ””โ”€โ”€ asgi.py           # WebSocket support
โ”œโ”€โ”€ turnin_app/            # Main application
โ”‚   โ”œโ”€โ”€ models.py         # Database models
โ”‚   โ”œโ”€โ”€ views.py          # API endpoints
โ”‚   โ”œโ”€โ”€ browser_service.py # Browser Use integration
โ”‚   โ”œโ”€โ”€ consumers.py      # WebSocket consumers
โ”‚   โ”œโ”€โ”€ routing.py        # WebSocket routing
โ”‚   โ”œโ”€โ”€ admin.py          # Admin interface
โ”‚   โ””โ”€โ”€ templates/        # Frontend templates
โ”œโ”€โ”€ requirements.txt      # Python dependencies
โ”œโ”€โ”€ .env                  # Environment variables
โ””โ”€โ”€ README.md            # This file

๐Ÿš€ Ready to Use!

The system is now fully configured and ready to use:

  1. โœ… Dependencies: All packages installed
  2. โœ… Database: Models created and migrated
  3. โœ… Admin User: Created (admin/admin123)
  4. โœ… Browser Support: Playwright browsers installed
  5. โœ… Configuration: Environment variables set up
  6. โœ… Server: Running on http://localhost:8000

๐ŸŽฏ Next Steps

  1. ๐Ÿ”‘ Add API Keys: Update the .env file with your actual AI provider API keys
  2. ๐Ÿงช Test the System: Create a test assignment and watch the AI agent work
  3. ๐Ÿ‘ฅ Create Users: Set up user accounts for students
  4. ๐Ÿ“Š Monitor Performance: Use the admin interface to track system performance
  5. ๐Ÿ”ง Customize: Modify the system to fit your specific needs

โš ๏ธ Important Notes

  • API Keys Required: You need valid API keys for AI providers (OpenAI, Anthropic, etc.)
  • Browser Support: System works best with Chrome/Chromium browsers
  • IUSD Integration: Designed for IUSD school district (customizable)
  • Educational Use: Ensure compliance with academic integrity policies

๐Ÿ†˜ Support

For support and questions:

  • ๐Ÿ“Š Check the admin interface for system logs
  • โšก Review WebSocket connections for real-time issues
  • ๐Ÿ‘€ Monitor task execution through the live browser feature
  • ๐Ÿ“ง Contact the development team for technical support

โš ๏ธ Disclaimer

This system is for educational purposes. Users are responsible for ensuring compliance with their institution's academic integrity policies.


Made with โค๏ธ for automating student assignments using AI and Browser Use technology.

About

AI-powered agent that automatically completes and submits online assignments using LLMs, Browser Use automation, and real-time WebSocket updates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors