diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..69ef702 --- /dev/null +++ b/.env.example @@ -0,0 +1,22 @@ +# ============================================================================= +# Auto Life Plan Video Generator - Environment Variables +# ============================================================================= +# Copy this file to .env and fill in your actual API keys +# DO NOT commit .env to version control! + +# Google Gemini API (for PDF parsing and script generation) +GEMINI_API_KEY=your_gemini_api_key_here + +# OpenAI API (for Whisper transcription) +OPENAI_API_KEY=your_openai_api_key_here + +# Pexels API (for B-Roll footage) +PEXELS_API_KEY=your_pexels_api_key_here + +# Google Cloud TTS (optional, if using TTS) +# GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json + +# Configuration +DEFAULT_INFLATION_RATE=0.02 +DEFAULT_DEFICIT_INTEREST_RATE=0.15 +DEFAULT_INVESTMENT_RETURN=0.03 diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..11f5d6d --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,275 @@ +# Project Overview: Life Plan Video Generator (PoC) + +## 1\. Ultimate Goal + +To build an automated pipeline that transforms a static **Life Plan Report (PDF)** and raw **Interview Footage** into a **3-5 minute dynamic explanatory video (MP4)**. The system is designed to help insurance consultants visualize complex financial data (e.g., asset depletion, inflation risks) for clients, creating an emotional and logical narrative to support decision-making. + +## 2\. Core Architecture + +The system follows a "Hybrid Local/Cloud" architecture to handle sensitive data and heavy video processing efficiently. + +### **Backend (Python / Logic Layer)** + +- **Role:** The "Brain". Handles data extraction, logic calculation, and asset preparation. +- **Tech Stack:** Python 3.10+, LangChain, Google Gemini 1.5 Pro (via API). +- **Key Responsibilities:** + 1. **Ingestion:** Parse complex Japanese PDFs (Sony Life Reports) using Gemini 1.5 Pro. + 2. **Structured Output:** Convert unstructured text into strict JSON (Zod Schema compliant). + 3. **Simulation Engine:** Calculate future asset projections (inflation, compound interest on deficits) to fill missing data points (Linear Interpolation). + 4. **Asset Prep:** Use `FFmpeg` (stream copy) to slice raw interview videos based on timestamps. + +### **Frontend / Rendering (Remotion / Visual Layer)** + +- **Role:** The "Renderer". Converts JSON data into video frames. +- **Tech Stack:** TypeScript, React, Remotion, Recharts, Zod. +- **Key Responsibilities:** + 1. **Programmatic Video:** Render UI components as video frames. + 2. **Dynamic Charts:** Visualize "Asset Depletion" and "Sufficiency Rates" using `Recharts`. + 3. **Frame Synchronization:** Drive animations strictly via `useCurrentFrame()` (no CSS transitions). + +--- + +## 3\. Remotion Specifics (Copilot Instructions) + +### **What does Remotion do in this project?** + +Remotion is **NOT** just a video editor; it is a **code-based rendering engine**. It treats the video timeline as a function of state `f(frame) = UI`. + +### **Critical Implementation Rules** + +1. **No Internal Animations:** + - When using `Recharts`, always set `isAnimationActive={false}`. + - **Reason:** Remotion renders frame-by-frame. Internal library animations rely on real-time timers, which break during rendering, causing flickering or static frames. + - **Solution:** Drive data slicing using `interpolate(frame, [start, end], [0, dataLength])`. + +2. **Asset Handling:** + - Do **NOT** import huge video files directly into React. Use URL references or local paths managed by the Python backend. + - Use `