# pr1mo-productions/oliana architecture

> Architecture diagram of the GitHub repository pr1mo-productions/oliana, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pr1mo-productions/oliana
- Repository: https://github.com/pr1mo-productions/oliana

## Overview

##### Main Components

a) Core Components:
- Oliana-Lib (Shared utilities)
- Oliana-Images (Image generation service)
- Oliana-Text (Text generation service)
- Oliana-Server (Network communication layer)
- Oliana-CLI (Command-line interface)
- Oliana-GUI (Graphical interface)

b) External Dependencies:
- Python 3.10+
- CUDA/GPU Services
- System Python Libraries
- LibTorch

##### Component Relationships

- [External Services Layer]
- CUDA/GPU ---- Python 3.10+
- /
- /
**[Client Layer]                  [Service Layer]                [Core Layer]**

- Oliana-CLI  |---------------|Oliana-Server  |--------------|Oliana-Lib  |
- RPC       +---------------+    Uses       +------------+

- Oliana-GUI  |----------------+           |
- RPC                    |

- [Processing Layer]

- Oliana-Images |

- Oliana-Text   |

##### Important Details

a) Cache Management:
- Local cache system (`~/.cache/oliana_lib/` or `%LOCALAPPDATA%\oliana_lib\`)
- Model file storage locations

b) Communication Flows:
- Bi-directional RPC communication between clients and server
- Async nature of the server-client communication
- TCP/IPv4/IPv6 support

c) Processing Pipelines:
- GPU-accelerated pipelines for both image and text generation
- Model file management flow

##### Technical Specifications to Note

- A note about the tarpc + serde implementation for binary transport
- Supported protocols (TCP over IPv4/IPv6)
- Separation of concerns between components
- Cache directory structure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External["External Services Layer"]
        CUDA["CUDA/GPU Services"]
        Python["Python 3.10+"]
        LibTorch["LibTorch"]
    end

    subgraph Client["Client Layer"]
        CLI["Oliana-CLI"]:::client
        GUI["Oliana-GUI"]:::client
    end

    subgraph Core["Core Layer"]
        Lib["Oliana-Lib"]:::core
        subgraph LibComponents["Library Components"]
            direction TB
            ErrorH["Error Handling"]:::core
            FileM["File Management"]:::core
            Launch["Launcher Functions"]:::core
            BuildM["Build Metadata"]:::core
        end
    end

    subgraph Server["Service Layer"]
        OServer["Oliana-Server"]:::server
        subgraph ServerComponents["Server Components"]
            direction TB
            SImpl["Server Implementation"]:::server
            CImpl["Client Implementation"]:::server
            SLib["Server Library"]:::server
        end
    end

    subgraph Processing["Processing Layer"]
        Images["Oliana-Images"]:::processing
        Text["Oliana-Text"]:::processing
    end

    subgraph Cache["Cache Layer"]
        LocalCache[".cache/oliana_lib/"]:::cache
    end

    %% Relationships
    CLI --> |RPC| OServer
    GUI --> |RPC| OServer
    OServer --> |Uses| Lib
    OServer --> |Manages| Images
    OServer --> |Manages| Text
    Images --> |Uses| CUDA
    Text --> |Uses| CUDA
    Images --> |Uses| Python
    Text --> |Uses| Python
    Images --> |Uses| LibTorch
    Text --> |Uses| LibTorch
    Images --> |Uses| LocalCache
    Text --> |Uses| LocalCache

    %% Component Connections
    Lib --- ErrorH
    Lib --- FileM
    Lib --- Launch
    Lib --- BuildM
    OServer --- SImpl
    OServer --- CImpl
    OServer --- SLib

    %% Click Events
    click CLI "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-CLI/src/main.rs"
    click GUI "https://github.com/Pr1mo-Productions/Oliana/tree/master//Oliana-GUI/src"
    click Lib "https://github.com/Pr1mo-Productions/Oliana/tree/master//Oliana-Lib/src"
    click ErrorH "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Lib/src/err.rs"
    click FileM "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Lib/src/files.rs"
    click Launch "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Lib/src/launchers.rs"
    click BuildM "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Lib/src/build_meta.rs"
    click OServer "https://github.com/Pr1mo-Productions/Oliana/tree/master//Oliana-Server/src"
    click SImpl "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Server/src/oliana_server.rs"
    click CImpl "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Server/src/oliana_client.rs"
    click SLib "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Server/src/oliana_server_lib.rs"
    click Images "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Images/src/main.rs"
    click Text "https://github.com/Pr1mo-Productions/Oliana/blob/master//Oliana-Text/src/main.rs"

    %% Styles
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef server fill:#e74c3c,stroke:#c0392b,color:white
    classDef processing fill:#f1c40f,stroke:#f39c12,color:black
    classDef cache fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#bdc3c7,stroke:#95a5a6,color:black
```
