# stringandstickytape/maxsaistudio architecture

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

- Interactive diagram: https://gitdiagram.com/stringandstickytape/maxsaistudio
- Repository: https://github.com/stringandstickytape/maxsaistudio

## Overview

##### Main Components

a) Core Application Layer:
- UI Components (WebView-based interface)
- Conversation Management System
- Provider Integration Layer
- Embeddings System
- Audio Processing System
- File Management System

b) External Services:
- AI Providers (OpenAI, Claude, Groq, Gemini, Ollama)
- WhisperX (for transcription)
- External visualization services (PlantUML)

**[User Interface Layer]**

**[Application Core]**

**[Service Integration Layer]**

**[External Services]**

##### Component Details

a) User Interface Layer:
- WebView-based main interface
- Three main UI sections: Header Bar, Messages Pane, User Input Bar
- Sidebar with conversation management
- Various UI controls (Attach, Voice, Project, Theme buttons)

b) Application Core:
- Conversation Manager (handles chat history and branching)
- Template Manager (manages chat templates)
- Embeddings Manager (handles vector embeddings for context)
- File Attachment Manager (handles various file types)
- Audio Manager (handles voice input and transcription)

c) Service Integration Layer:
- AI Service Resolver (routes requests to appropriate providers)
- Provider-specific adapters (OpenAI, Claude, Groq, etc.)
- Embeddings Integration
- External Tool Integration

d) External Services:
- AI Provider APIs
- WhisperX Integration
- Visualization Services

##### Important Relationships to Highlight

- Bidirectional communication between UI and Application Core
- How the AI Service Resolver routes requests to different providers
- Demonstrate the file attachment flow through the system
- How embeddings are integrated into the conversation flow
- Audio processing pipeline

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        MainApp["Main Application"]
        WebView["WebView Interface"]
        MessagesPane["Message Display"]
        UserInput["User Input Bar"]
        UIComponents["UI Components"]
    end

    subgraph Core["Application Core"]
        ConvManager["Conversation Manager"]
        ConvModel["Conversation Model"]
        BranchSystem["Branching System"]
        CacheManager["Cache Management"]
        TempManager["Template Manager"]
        Settings["Settings Manager"]
    end

    subgraph Integration["Service Integration Layer"]
        ServiceResolver["AI Service Resolver"]
        BaseService["Base Service"]
        subgraph Providers["Provider Implementations"]
            OpenAI["OpenAI Provider"]
            Claude["Claude Provider"]
            Groq["Groq Provider"]
            Gemini["Gemini Provider"]
            Ollama["Ollama Provider"]
        end
    end

    subgraph Support["Support Systems"]
        EmbedManager["Embeddings Manager"]
        EmbedHelper["Embeddings Helper"]
        Fragmenters["Fragmenters"]
        AudioRec["Audio Recorder"]
        AudioMgr["Audio Manager"]
        FileManager["File Manager"]
        FileClass["File Classifier"]
    end

    subgraph VSIX["VSIX Integration"]
        MsgHandler["Message Handler"]
        ChatWindow["Chat Window"]
        VSIXPkg["VSIX Package"]
    end

    subgraph Viz["Visualization Services"]
        PlantUML["PlantUML Viewer"]
        NetDiagram["Network Diagrams"]
        OtherViewers["Various Viewers"]
    end

    MainApp --> WebView
    WebView --> MessagesPane
    WebView --> UserInput
    WebView --> UIComponents

    ConvManager --> ConvModel
    ConvManager --> BranchSystem
    ConvManager --> CacheManager
    ConvManager --> TempManager

    ServiceResolver --> BaseService
    BaseService --> OpenAI
    BaseService --> Claude
    BaseService --> Groq
    BaseService --> Gemini
    BaseService --> Ollama

    EmbedManager --> EmbedHelper
    EmbedManager --> Fragmenters
    AudioMgr --> AudioRec
    FileManager --> FileClass

    MsgHandler --> ChatWindow
    MsgHandler --> VSIXPkg

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef ui fill:#FFE6CC,stroke:#D79B00
    classDef core fill:#DAE8FC,stroke:#6C8EBF
    classDef integration fill:#D5E8D4,stroke:#82B366
    classDef support fill:#E1D5E7,stroke:#9673A6
    classDef vsix fill:#FFF2CC,stroke:#D6B656
    classDef viz fill:#F8CECC,stroke:#B85450

    class MainApp,WebView,MessagesPane,UserInput,UIComponents ui
    class ConvManager,ConvModel,BranchSystem,CacheManager,TempManager,Settings core
    class ServiceResolver,BaseService,OpenAI,Claude,Groq,Gemini,Ollama integration
    class EmbedManager,EmbedHelper,Fragmenters,AudioRec,AudioMgr,FileManager,FileClass support
    class MsgHandler,ChatWindow,VSIXPkg vsix
    class PlantUML,NetDiagram,OtherViewers viz

    click MainApp "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/UI/Forms/MaxsAiStudio.cs"
    click WebView "https://github.com/stringandstickytape/MaxsAistudio/blob/main/SharedClasses/HTML/ChatWebView2.html"
    click MessagesPane "https://github.com/stringandstickytape/MaxsAistudio/blob/main/SharedClasses/JSX/MessagesPane.jsx"
    click UserInput "https://github.com/stringandstickytape/MaxsAistudio/blob/main/SharedClasses/JSX/UserInputBar.jsx"
    click UIComponents "https://github.com/stringandstickytape/MaxsAistudio/tree/main/SharedClasses/JSX"
    click ConvManager "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Conversations/ConversationManager.cs"
    click ConvModel "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Conversations/Conversation.cs"
    click BranchSystem "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Conversations/BranchedConversation.cs"
    click CacheManager "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Conversations/ConversationCacheManager.cs"
    click ServiceResolver "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/AiServiceResolver.cs"
    click BaseService "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/AiServiceBase.cs"
    click OpenAI "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/OpenAI.cs"
    click Claude "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/Claude.cs"
    click Groq "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/Groq.cs"
    click Gemini "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/Gemini.cs"
    click Ollama "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Providers/Ollama.cs"
    click EmbedManager "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Embeddings/EmbeddingManager.cs"
    click EmbedHelper "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Embeddings/EmbeddingsHelper.cs"
    click Fragmenters "https://github.com/stringandstickytape/MaxsAistudio/tree/main/AiTool3/Embeddings/Fragmenters"
    click AudioRec "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Audio/AudioRecorder.cs"
    click AudioMgr "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Audio/AudioRecorderManager.cs"
    click FileManager "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/FileAttachments/FileAttachmentManager.cs"
    click FileClass "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/Helpers/FileTypeClassifier.cs"
    click MsgHandler "https://github.com/stringandstickytape/MaxsAistudio/blob/main/VSIXTest/Communications/VsixMessageHandler.cs"
    click ChatWindow "https://github.com/stringandstickytape/MaxsAistudio/blob/main/VSIXTest/UI/ChatWindowControl.xaml"
    click VSIXPkg "https://github.com/stringandstickytape/MaxsAistudio/blob/main/VSIXTest/VSIXTestPackage.cs"
    click PlantUML "https://github.com/stringandstickytape/MaxsAistudio/blob/main/AiTool3/UI/PlantUMLViewer.cs"
    click NetDiagram "https://github.com/stringandstickytape/MaxsAistudio/blob/main/SharedClasses/JavaScript/NetworkDiagramJavascriptControl.js"
    click OtherViewers "https://github.com/stringandstickytape/MaxsAistudio/tree/main/SharedClasses/JavaScriptViewers"
```
