Skip to content

Complete Interaction Sequences

The detailed sequence diagrams below cover all stages of interaction with the Aiuta SDK. The diagrams help visualize the flow of operations, such as initialization and the try-on process, highlighting the roles of the user, your app, backend services and Aiuta SDK.

Authentication of requests from the SDK to the Aiuta API/Backend based on the configuration provided is described here.

Configuration

Initialization process from launching the app to displaying products, including SDK configuration.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>APP: Launch the App
    par
        APP->>SDK: Initialize with Configuration

        activate SDK
        Note over APP,SDK: Includes auth, UI, features, analytics
        SDK->>API: Request internal configuration
        API-->>SDK: Internal configuration
        opt predefined models feature
            SDK->>API: Request predefined models
            API-->>SDK: Predefined models collection
        end
        deactivate SDK
    and
        APP->>BE: Load products
        BE-->>APP: Products
        Note over APP,BE: Including a flag whether<br>a virtual try-on is available
        APP-->>USR: Show products
        Note over APP,USR: Including a try-on button for<br>products with try-on feature
    end

Find more about 2 Aiuta Configuration here

Please note in 8 – 9 that you should obtain information about the availability of the virtual try-on feature for each of your products from your backend, as the SDK does not receive information about product availability and will attempt to launch a virtual try-on with any product you provide, which may result in an error if that product has not been trained by Aiuta.

Usage

Configuration examples

You can switch the example configuration presets for the diagrams below to see the differences when using built-in or custom data providers, as well as some differences when using additional functionality.

  • BuiltIn data providers
  • Default features set
  • Embedded legal info
  • Custom data providers
  • All features including wishlist
  • Standalone consent when upload a photo

Try-On

The following sequence diagrams illustrate the process of a virtual try-on using the Aiuta SDK. They cover the entire workflow from the moment a user initiates a try-on request to the final rendering of the virtual try-on result, highlighting key actions such as image selection, authentication, and data processing.

Pick a Photo

Detailed sequence of the user selecting the source image for the virtual try-on.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>APP: Tap Try-on Button
    APP->>SDK: Start Try-on (Product)
    activate SDK
    SDK-->>USR: Present SDK UI

    USR->>SDK: Select / take a new photo
    SDK->>API: Upload a photo
    activate API
    API->>GS: Save input image
    Note over API,GS: Anonymous.<br>The photo is associated with the<br>app entry, not the user entry
    API->>API: Generate image ID, form URL
    API-->>SDK: Return image ID, URL
    deactivate API

    SDK->>SDK: Start Try-on (Image)
    deactivate SDK
sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>APP: Tap Try-on Button
    APP->>SDK: Start Try-on (Product)
    activate SDK
    SDK-->>USR: Present SDK UI

    USR->>SDK: Select model / previously used photo
    SDK->>SDK: Add/Reorder image in the history
    Note right of SDK: Using the image ID

    SDK->>SDK: Start Try-on (Image)
    deactivate SDK

Detailed sequence of the user selecting the source image for the virtual try-on with custom configuration.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>APP: Tap Try-on Button
    APP->>SDK: Start Try-on (Product)
    activate SDK
    SDK-->>USR: Present SDK UI

    USR->>SDK: Tap upload a photo
    SDK->>SDK: Check consent obtained
    opt consent required
        SDK-->>USR: Present consent page
        USR->>SDK: Accept consent terms
        SDK->>APP: Call obtainConsentIds (consent IDs)
        APP->>BE: Store consents obtained
    end

    SDK-->>USR: Show options for uploading
    USR->>SDK: Select/take a new photo
    SDK->>API: Upload a photo
    activate API
    API->>GS: Save input image
    Note over API,GS: Anonymous.<br>The photo is associated with the<br>app entry, not the user entry
    API->>API: Generate image ID, form URL
    API-->>SDK: Return image ID, URL
    deactivate API

    SDK->>SDK: Start Try-on (Image)
    deactivate SDK
sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>APP: Tap Try-on Button
    APP->>SDK: Start Try-on (Product)
    activate SDK
    SDK-->>USR: Present SDK UI

    USR->>SDK: Select model / previously used photo
    SDK->>APP: Add/Select image in the history
    APP->>BE: Update uploads history
    Note over APP,BE: Recent image first in the list
    APP-->>SDK: Update data provider observable list

    SDK->>SDK: Start Try-on (Image)
    deactivate SDK

Making Try-On

The sequence diagram of executing a virtual try-on operation.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>SDK: Pick a Photo / Tap Try-on button in the SDK UI
    activate SDK

    SDK->>API: Create operation<br>(image ID, product ID)
    activate API
    Note over SDK,API: Secure authenticated request
    API-->>SDK: Operation ID

    par
        API->>API: Generate image
        API->>GS: Save generated image
        deactivate API
        Note over API,GS: Anonymous.<br>The photo is associated with the<br>app entry, not the user entry
    and
        loop internal configuration delay
            SDK->>API: Request operation status
            API-->>SDK: Operation details
            Note over API,SDK: status, generated_images | error
            SDK-->>SDK: Check operation status
            Note over SDK: Repeat while<br>CREATED | IN_PROGRESS | PAUSED

        end
    end

    critical Check operation status
        option SUCCESS
            SDK->>SDK: Add images to the history
            SDK->>GS: Get result image by the URL
            activate GS
            GS-->>SDK: Image data
            deactivate GS
            SDK-->>USR: Present results
            Note over SDK,USR: User may interact with results

        option ABORTED
            rect
                SDK-->>USR: Report couldn't detect anyone
            end
            Note over SDK,USR: User may select other photo and start over

        option FAILED | CANCELLED
            rect
                SDK-->>USR: Show something went wrong error
                deactivate SDK
            end
            Note over SDK,USR: User may try again to start over
    end

Viewing Results

The sequence diagram of executing a virtual try-on operation.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    Note over SDK,API: After successful try-on generation

    opt Cart
        USR->>SDK: Tap Add to cart
        SDK->>SDK: Close UI
        SDK->>APP: Call addToCart (product ID)
        APP-->>USR: Cart
    end

    opt Share
        USR->>SDK: Tap Share button
        SDK-->>USR: Show system share dialog
        Note over SDK,USR: Generated image to share
        USR->>SDK: Complete sharing
    end

The sequence diagram of executing a virtual try-on operation.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    Note over SDK,API: After successful try-on generation

    opt Cart
        USR->>SDK: Tap Add to cart
        SDK->>SDK: Close UI
        SDK->>APP: Call addToCart (product ID)
        APP-->>USR: Cart
    end

    opt Wishlist
        USR->>SDK: Tap Wishlist button
        SDK->>APP: Toggle setProductInWishlist (product ID)
        APP->>BE: Update wishlist
        APP-->>SDK: Update observable wishlistProductIds
        SDK->>SDK: Update wishlist button state
    end

    opt Share
        USR->>SDK: Tap Share button
        SDK->>APP: Call getShareText (product IDs)
        APP-->>SDK: Return share text
        SDK-->>USR: Show system share dialog
        Note over SDK,USR: Generated image and optional text to share
        USR->>SDK: Complete sharing
    end

Managing History

The following sequence diagram illustrates the process of managing images history using the Aiuta SDK. It covers the workflow from adding and viewing the history to deleting existing ones. The diagrams are the same for the uploaded and generated history, as the processes are identical and only differ in the UI.

Adding/Viewing Images in the History

The sequence diagram of adding newly uploaded and generated images to the user's history.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    Note over SDK,API: After successful try-on generation
    activate SDK
    SDK->>SDK: Add new images<br>to the user's history
    Note right of SDK: Local storage
    SDK->>SDK: Update local history display
    deactivate SDK

    USR->>SDK: Tap History Button / Change photo
    activate SDK
    SDK-->>USR: Display History Data
    Note over SDK,USR: Shows list of generated / uploaded<br>images with most recent first

    opt cache not exitst/expired
        SDK->>GS: Get images by the URL
        GS-->>SDK: Images data
        SDK->>SDK: Cache images
        deactivate SDK
    end

See details about Try-on generation process here

The sequence diagram of adding newly uploaded and generated images to the user's history using custom data providers.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    APP->>SDK: Provide configuration with observable data providers
    activate SDK
    SDK-->>SDK: Subscribe to observable<br>history lists changes
    deactivate SDK

    Note over SDK,API: After successful try-on generation
    activate SDK
    SDK->>APP: Call addUploadedImages / addGeneratedImages
    APP->>BE: Link new images<br>to the user's history
    APP-->>SDK: Update observable data providers
    SDK->>SDK: Update local history display
    deactivate SDK

    USR->>SDK: Tap History Button / Change photo
    activate SDK
    SDK-->>USR: Display History Data
    Note over SDK,USR: Shows list of generated / uploaded<br>images with most recent first

    opt cache not exitst/expired
        SDK->>GS: Get images by the URL
        GS-->>SDK: Images data
        SDK->>SDK: Cache images
        deactivate SDK
    end

See details about

Deleting Images from the History

The sequence diagram of removing images from the user's history.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>SDK: Select image(s) to delete
    activate SDK
    SDK-->>SDK: Delete records from the history
    Note right of SDK: Local storage
    SDK-->>USR: Show updated history
    deactivate SDK

The sequence diagram of removing images from the user's history using custom data providers.

sequenceDiagram
    autonumber
    actor USR as ⠀<br>User
    participant APP as Your<br>App
    participant BE as Your<br>Backend
    participant SDK as Aiuta<br>SDK
    participant API as Aiuta<br>Backend
    participant GS as Storage
    note over GS: Aiuta or Yours

    USR->>SDK: Select image(s) to delete
    activate SDK

    SDK-->>USR: Show activity indicator
    SDK->>APP: Call deleteUploadedImages / deleteGeneratedImages
    activate APP
    APP->>BE: Delete images
    activate BE

    opt user owned images 
        alt Aiuta storage
            BE->>API: Delete images by ID
            activate API
            API-xGS: Delete files
            API-->>BE: Deletion response
            deactivate API
        else your storage
            BE-xGS: Delete files
        end
    end
    BE->>BE: Remove images from the user's records

    BE-->>APP: Acknowledge deletion
    deactivate BE

    APP-->>SDK: Acknowledge deletion
    SDK-->>USR: Hide activity indicator
    APP-->>SDK: Update observable history lists
    deactivate APP

    SDK->>SDK: Update history display
    SDK-->>USR: Show updated history
    deactivate SDK

Important: Owner Type Handling

When deleting images from the history, the behavior depends on the ownerType

  • user images can be deleted from storage and removed from history
  • aiuta images should only be unlinked from user history, not deleted from storage

This ensures that shared model images remain available for other users while user-generated content can be properly cleaned up