How nerve-sparks/iris_android works
Main Components
• UI Layer: This includes all the screens and components under the “app/src/main/java/com/nervesparks/iris/ui” package. It comprises screens like ChatScreen, AboutScreen, ModelsScreen, ParametersScreen, and UI components (e.g., ChatSection, DownloadModal) that form the graphical interface.
• Application Logic / ViewModel: Elements such as MainViewModel and possibly other helper classes form the mediator between the UI and underlying business logic. This layer encapsulates user interactions and state management.
• Data Management: The “app/src/main/java/com/nervesparks/iris/data” folder (e.g., UserPreferencesRespository) manages configuration, user settings, and possibly the model download metadata.
• Native Module (llama): The “llama” directory contains the native (C/C++) code along with its JNI integration (such as LLamaAndroid.kt). This part of the system wraps underlying llama.cpp functionality to execute machine learning tasks offline.
• Model & Download Manager: Since the app downloads GGUF models from Hugging Face, clearly denote the module or component responsible for model downloading, storage, and selection logic.
• External/Platform Services: Represent interactions with Android’s system services such as Text-to-Speech, Speech-to-Text (as noted in the README), as well as Android’s debugging and deployment mechanisms.
Relationships and Data Flow
• How the UI components (screens and custom components) connect to the MainViewModel, which processes user input and manages presentation logic.
• From the ViewModel, illustrate interactions with the data repository for retrieving user preferences, saving settings, and managing downloaded models.
Architectural Patterns and Technologies
• Use of the MVVM pattern: clearly display separate layers for Model (data), ViewModel (logic), and View (UI).
• Integration of native C++ code via a dedicated module (llama) that relies on JNI bridging (as indicated by the java and cpp code).
• Mention any Android-specific libraries or build technologies (e.g., Gradle, CMake for the native build) that have configuration files (build.gradle.kts, CMakeLists.txt) present in the project.
• How the customizable parameters (e.g., n_threads, top_k, etc.) are provided as configurations to the engine.
• A block for the Android UI Layer that contains screens like MainChatScreen, ChatScreen, SettingsScreen, etc.
• A block for the Application Logic / MVVM Layer showing MainActivity, MainViewModel.
• A block for Data/Repository showing UserPreferencesRepository and download management logic.
• Optional blocks representing external services (Hugging Face for model downloads) and Android system services (Speech-to-Text/Text-to-Speech).
Happy diagramming!