Skip to content

rahimbaig28/Small-Projects-Using-Py-and-HTML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

995 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Perplexity AI Daily Code Generator

This repository automatically generates new single-file apps (either HTML or Python) every day using the Perplexity AI API, powered by GitHub Actions automation.
Each run creates a new prompt, builds a working app, and commits the results back to the repository for version tracking.


🧩 Project Overview

The system works in two main stages:

  1. Prompt Generation – A creative, structured product specification is generated using Perplexity.
  2. App Generation – Based on the prompt, Perplexity builds a complete single-file application that can be an HTML app (with inline CSS and JavaScript) or a pure Python script.

All results are automatically saved in organized folders under dist/:

  • dist/prompts/ – versioned prompt text files describing each generated app
  • dist/apps/ – versioned generated applications (.html or .py)
  • dist/latest/ – the most recent prompt and app for quick access
  • dist/log.txt – log of all runs with timestamps and statuses

⚙️ Repository Structure

automation/ │ ├── generate.py → Main script that handles prompt generation and app creation │ .github/ │ └── workflows/ └── daily-perplexity.yml → GitHub Actions workflow that automates daily code generation │ dist/ │ ├── apps/ → Generated applications (HTML or Python) ├── prompts/ → Generated prompt specifications ├── latest/ → Latest generated prompt and app for quick access └── log.txt → Log file containing timestamps and status of each run


🧠 How It Works

  • API Endpoint: https://api.perplexity.ai/chat/completions
  • Model: sonar (can be overridden via workflow environment variable)
  • Automation: GitHub Actions runs once per day at 13:00 UTC (≈ 9 AM US Eastern)
  • Retries: The workflow automatically retries failed API calls up to three times, with exponential backoff.
  • Timeouts: Each API call allows up to 420 seconds for a response.
  • Logging: Every success or failure is appended to dist/log.txt for easy debugging.

🚀 Run Sequence

  1. GitHub Action triggers daily (or manually via Run workflow).
  2. The Python script generate.py runs and:
    • Generates a creative prompt for a new single-file app.
    • Builds the complete app (HTML or Python) based on that prompt.
  3. Generated files are versioned (no overwrites). If a filename already exists, it’s automatically saved as -2, -3, etc.
  4. All new files are committed and pushed back to the repository with the message “automation using Perplexity AI.”

🔑 Setup Instructions

  1. Clone or fork this repository.
  2. In your repository settings, go to Settings → Secrets and variables → Actions → New repository secret.
  3. Add a secret named PPLX_API_KEY with your Perplexity API key.
  4. Commit your workflow YAML file (.github/workflows/daily-perplexity.yml).
  5. Run the workflow manually once to verify the setup.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages