/CodeSnapGPT

Primary LanguageJavaScript

CodeSnapGPT

Extract text from an image or screenshot and ask the AI from your own configuration.

Setup

Environment File Required

Before running this application, you must create a .env file in the root directory of the project. This file contains sensitive configuration variables that the application needs to function properly.

Required Environment Variables

Create a .env file in the root directory and add the following variables:

# Gemini AI Configuration
GEMINI_API_KEY=your_gemini_api_key_here

# Email Configuration (Gmail)
EMAIL=your_gmail_address@gmail.com
PASSWORD=your_gmail_app_password
TO_EMAIL=recipient_email@example.com

# Screenshot Monitoring
SCREENHOT_PATH=/path/to/your/screenshots/folder
FUNCTION_INTERVAL=5000
INTERVAL=5000

How to Get Required Values:

  1. GEMINI_API_KEY:

  2. EMAIL & PASSWORD:

    • Use your Gmail address for EMAIL
    • For PASSWORD, use an App Password (not your regular Gmail password)
    • Enable 2-factor authentication on your Google account
    • Generate an App Password: Google Account Settings
  3. TO_EMAIL:

    • The email address where you want to receive the AI analysis results
  4. SCREENHOT_PATH:

    • The full path to the folder where your screenshots are saved
    • Example: /Users/yourusername/Desktop/Screenshots
  5. FUNCTION_INTERVAL & INTERVAL:

    • Time in milliseconds between screenshot checks
    • Default: 5000 (5 seconds)

Example .env file:

GEMINI_API_KEY=AIzaSyD...your_actual_api_key_here...XYZ
EMAIL=yourname@gmail.com
PASSWORD=abcd efgh ijkl mnop
TO_EMAIL=recipient@example.com
SCREENHOT_PATH=/Users/yourname/Desktop/Screenshots
FUNCTION_INTERVAL=5000
INTERVAL=5000

Installation & Usage

  1. Clone this repository
  2. Run npm install to install dependencies
  3. Create your .env file with the required variables (see above)
  4. Run npm start to start the application

The application will monitor your screenshots folder and automatically:

  • Extract text from new screenshots using OCR
  • Send the text to Gemini AI for analysis
  • Email you the AI's response

Important Notes

  • Never commit your .env file to version control - it contains sensitive information
  • The .env file should be in your .gitignore file
  • Make sure your screenshot path exists and is accessible
  • Gmail requires an App Password, not your regular password