Skip to content

feat: integrate Gemini AI, free media engines, asynchronous task tracker, and PM2 auto-boot daemon#6

Open
randykaskuser wants to merge 10 commits into
darkzOGx:masterfrom
randykaskuser:master
Open

feat: integrate Gemini AI, free media engines, asynchronous task tracker, and PM2 auto-boot daemon#6
randykaskuser wants to merge 10 commits into
darkzOGx:masterfrom
randykaskuser:master

Conversation

@randykaskuser

Copy link
Copy Markdown

Description

This pull request transitions the YouTube Automation Agent from a synchronous, OpenAI-dependent local runner into a production-ready, 24/7 background-daemonized platform. By introducing Google Gemini, free community media generation tools, asynchronous task tracking, and a glassmorphic real-time dashboard, the system can now run continuously on a remote VPS without risk of browser request timeouts or active client shutdowns.


🛠️ Summary of Changes

1. 🤖 Gemini AI & Free Content Engine Integration

  • Credential Manager (utils/credential-manager.js): Updated to allow server initialization and startup if either openai or gemini keys are defined in the environment.
  • Story Writer Agent (agents/script-writer-agent.js): Integrated gemini-2.5-flash to write rich, creative Indonesian children's stories tailored for the @ceritaku.singkat channel strategy.
  • Asset Generator (utils/ai-video-generator.js):
    • Connected scene prompt descriptions to a free cartoon generator powered by image.pollinations.ai.
    • Implemented an Indonesian Google Translate Text-to-Speech (TTS) narration synthesizer that chunks long text naturally and stitches the audio files seamlessly via fluent-ffmpeg.
  • Verification Script (test-gemini-flow.js): Created a standalone flow verification utility to validate Gemini responses, illustration downloads, and TTS assembly without running the full dashboard server.

2. ⚡ Non-Blocking Asynchronous Pipeline

  • Dashboard Server (index.js):
    • Refactored /generate into a non-blocking asynchronous endpoint that starts the process in a background worker and returns 200 OK instantly to prevent HTTP timeouts.
    • Exposed a /generation-status polling endpoint to report progress, current pipeline stage, logs, and estimated remaining duration.
    • Added uptime metrics to /health to support dashboard health checks.

3. 🎨 Premium Glassmorphic Dashboard

  • Monitoring UI (dashboard/index.html):
    • Resolved a client-side ReferenceError: process is not defined crash by retrieving platform uptime from /health.
    • Fixed card heights and removed persistent .loading classes to resolve card content overlap bugs.
    • Redesigned the entire interface into a stunning, responsive dark glassmorphic layout using the Google Fonts Outfit typography.
    • Added a dedicated Content Generation Hub control card featuring an active progress spinner, neon stage indicators (Queue, In Progress, Finished), and a live countdown timer showing estimated remaining seconds.

4. 🚀 VPS Daemonization & Uptime

  • PM2 Setup (ecosystem.config.js): Added a production PM2 config to run the service as a background daemon with an automatic memory restart threshold at 1GB.
  • Dependency Locking (package.json, package-lock.json): Added required utility libraries to handle text-to-speech downloads, folder sanitization, and concurrent execution.

5. 🔒 Security & Bloat Prevention

  • Ignore Patterns (.gitignore): Added /data/ and related directories to ensure dynamic assets (temporary image downloads, JSON files, output MP4 videos) and credential key backups are never committed or exposed.
  • Configuration (.env.example, README.md): Configured clear setup guides, missing variable examples, and deployment documentation to assist with manual configuration on fresh systems.

🚦 Verification Status

  1. Standalone Validation (test-gemini-flow.js):
    Successfully tested script drafting, Pollinations cartoon download, and audio concatenation with zero errors.
  2. Background Jobs (/generation-status):
    Verified that status endpoints return detailed JSON payloads mapping active sub-agent states:
    {
      "status": "generating",
      "currentStep": "Generating visual illustrations and synthesizing audio narration...",
      "steps": {
        "strategy": "completed",
        "script": "completed",
        "thumbnail": "completed",
        "seo": "completed",
        "production": "processing"
      },
      "estimatedSecondsRemaining": 115
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant