# hewking/aiplayground architecture

> Architecture diagram of the GitHub repository hewking/aiplayground, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hewking/aiplayground
- Repository: https://github.com/hewking/aiplayground

## Overview

Key Components to Include:

##### Trigger Layer
- GitLab CI/CD Pipeline
- Webhook Server

##### Core Application Layer
- Main Reviewer Component (gitlab_ai_reviewer.py)
- Configuration Management (src/config)
- Core Utilities (src/core)

##### Model Layer
- OpenAI Integration
- DeepSeek Integration
- Gemini Integration

##### GitLab Integration Layer
- Code Review Handler
- Webhook Handler
Components as intermediaries between the trigger layer and core application.

**┌─────────────────── Triggers ───────────────────┐**

- [GitLab CI/CD] ──────── [Webhook Server]    │

- ┼──────────────────────┼─────────────┘

**┌──────────┼──────────────────────┼─────────────┐**
- ▼                      ▼             │
- [GitLab Integration Layer]                 │
- Code Reviewer                            │
- Webhook Handler                          │

- ┬───────────────────────────┘

**┌───────────────────┼───────────────────────────┐**
- ▼                           │
- [Core Application Layer]                   │
- ┌─────────────────────────┐               │
- GitLab AI Reviewer     │               │
- Review Logic         │               │
- File Filtering       │               │
- Prompt Generation    │               │
- ┘               │

- ┼───────────────────────────┘

**┌───────────────────┼───────────────────────────┐**
- ▼                           │
- [AI Models Layer]                          │
- ┌─────────┬──────────┬─────────┐          │
- OpenAI  │ DeepSeek │ Gemini  │          │
- ┴──────────┴─────────┘          │

- ┘

Important Elements to Highlight:

##### Data Flow
- Flow of code review requests and responses

##### Component Relationships
- Inheritance relationships between AI models
- Configuration dependencies
- Async boundaries

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef trigger fill:#2374AB,color:white
    classDef gitlab fill:#FC6D26,color:white
    classDef core fill:#2E7D32,color:white
    classDef config fill:#6D4C41,color:white
    classDef model fill:#7B1FA2,color:white
    classDef error fill:#C62828,color:white

    %% Trigger Layer
    subgraph Triggers
        CI["GitLab CI/CD Pipeline"]:::trigger
        WS["Webhook Server"]:::trigger
    end

    %% GitLab Integration Layer
    subgraph GitLab Integration
        CRH["Code Review Handler"]:::gitlab
        WH["Webhook Handler"]:::gitlab
    end

    %% Core Application Layer
    subgraph Core Application
        MAR["Main Reviewer Component"]:::core
        CM["Configuration Management"]:::config
        CU["Core Utilities"]:::core
        EH["Error Handler"]:::error
    end

    %% Model Layer
    subgraph AI Models
        direction TB
        BLLM["Base LLM"]:::model
        OAI["OpenAI Integration"]:::model
        DSK["DeepSeek Integration"]:::model
        GEM["Gemini Integration"]:::model
    end

    %% Relationships
    CI --> CRH
    WS --> WH
    CRH --> MAR
    WH --> MAR
    MAR --> CM
    MAR --> CU
    MAR --> EH
    MAR --> BLLM
    BLLM --> OAI
    BLLM --> DSK
    BLLM --> GEM

    %% Click events
    click CI "https://github.com/hewking/AIPlayGround/blob/main/.gitlab-ci.yml"
    click MAR "https://github.com/hewking/AIPlayGround/blob/main/gitlab_ai_reviewer.py"
    click CM "https://github.com/hewking/AIPlayGround/blob/main/src/config/settings.py"
    click CU "https://github.com/hewking/AIPlayGround/blob/main/src/core/base.py"
    click EH "https://github.com/hewking/AIPlayGround/blob/main/src/core/exceptions.py"
    click CRH "https://github.com/hewking/AIPlayGround/blob/main/src/gitlab/code_reviewer.py"
    click WH "https://github.com/hewking/AIPlayGround/blob/main/src/gitlab/webhook_handler.py"
    click OAI "https://github.com/hewking/AIPlayGround/blob/main/src/models/openai_llm.py"
    click DSK "https://github.com/hewking/AIPlayGround/blob/main/src/models/deepseek_llm.py"
    click GEM "https://github.com/hewking/AIPlayGround/blob/main/src/models/gemini_llm.py"

    %% Legend
    subgraph Legend
        L1["Trigger Component"]:::trigger
        L2["GitLab Component"]:::gitlab
        L3["Core Component"]:::core
        L4["Config Component"]:::config
        L5["Model Component"]:::model
        L6["Error Handler"]:::error
    end
```
