| # 5. Component Architecture | |
| ### 5.1 New Components | |
| #### KeywordAnalysisService | |
| **Responsibility:** Handle keyword frequency analysis for content planning | |
| **Integration Points:** Integrated with existing content service and API endpoints | |
| **Key Interfaces:** | |
| - analyze_keyword_frequency(keywords: List[str]) -> Dict[str, str] | |
| **Dependencies:** | |
| - **Existing Components:** Uses existing database connection and authentication | |
| - **New Components:** None | |
| **Technology Stack:** Python, existing Flask framework | |
| #### ImageGenerationService (Updated) | |
| **Responsibility:** Handle image generation using FLUX.1-dev instead of Qwen | |
| **Integration Points:** Integrated with existing content service and AI workflow | |
| **Key Interfaces:** | |
| - generate_flux_image(prompt: str, seed: int, dimensions: tuple, guidance_scale: float, inference_steps: int) -> str | |
| **Dependencies:** | |
| - **Existing Components:** Uses existing gradio_client and authentication | |
| - **New Components:** None | |
| **Technology Stack:** Python, gradio_client, existing Flask framework | |
| ### 5.2 Component Interaction Diagram | |
| ```mermaid | |
| graph TB | |
| subgraph "Frontend" | |
| A[Posts Page] --> B[KeywordAnalysisPanel] | |
| A --> C[ImageGenerationPanel] | |
| B --> D[KeywordAnalysisService] | |
| C --> E[ImageGenerationService] | |
| end | |
| subgraph "Backend API" | |
| F[app.py] --> G[posts_bp] | |
| G --> H[content_service] | |
| G --> I[keyword_analysis_service] | |
| end | |
| subgraph "AI Services" | |
| H --> J[FLUX.1-dev via gradio_client] | |
| I --> K[Existing RSS/Post Data] | |
| end | |
| subgraph "Database" | |
| L[Supabase] --> H | |
| L --> I | |
| end | |
| D -.-> G | |
| E -.-> G | |
| B -.-> D | |
| C -.-> E | |
| ``` | |