How yunuseeeeeeee/yunze-spark works
Yunze Spark is an Android app for downloading language models and chatting with them entirely on-device. The main workflow is: browse the model catalog, download a model, open its chat, and stream an answer from native inference; conversations are saved per model. Users can also add custom model links and change language or theme settings. The graph includes the documented llama.cpp/JNI layer and settings capabilities. Several connections come from the README or SOURCE INDEX; unsampled implementation details are not inferred.
Main entry points: SparkNavHost.kt Navigation host · SparkApplication.kt Application services · ModelRepository.kt Model repository · ChatViewModel.kt Chat orchestration
Components 24
App entry and navigation
- Main activity
MainActivity.kt - Navigation host
SparkNavHost.kt - Application services
SparkApplication.kt
Model catalog and downloads
- Model browser
ModelListScreen.kt - Model list state
ModelListViewModel.kt - Custom model form
AddCustomModelScreen.kt - Model catalog
ModelCatalog.kt - Bundled catalog data
models_catalog.json - Model repository
ModelRepository.kt - Model downloader
ModelDownloadManager.kt - Local model files
ModelDownloadManager.kt - Model metadata and state
ModelInfo.kt
Chat and inference
- Chat interface
ChatScreen.kt - Chat orchestration
ChatViewModel.kt - Chat messages
ChatMessage.kt - Inference engine
InferenceEngine.kt - JNI bridge
LlamaBridge.kt - Native inference bridge
llama-bridge.cpp
Settings and persistence
- Chat history store
ChatHistoryStore.kt - Settings interface
SettingsScreen.kt - Settings state
SettingsViewModel.kt - App settings
AppSettings.kt
Other components
- App user
- Model hosting service
Connections 35
- App user → Main activity: opens app
MainActivity.kt - Main activity → Navigation host: starts
MainActivity.kt - Navigation host → Model browser: routes to
SparkNavHost.kt - Navigation host → Chat interface: routes to
SparkNavHost.kt - Navigation host → Settings interface: routes to
SparkNavHost.kt - Navigation host → Custom model form: routes to
SparkNavHost.kt - Navigation host → Application services: uses services
SparkNavHost.kt - Navigation host → Model list state: creates
SparkNavHost.kt - Navigation host → Chat orchestration: creates
SparkNavHost.kt - Navigation host → Settings state: creates
SparkNavHost.kt - Model browser → Model list state: observes state
ModelListScreen.kt - Model browser → Navigation host: opens chat or settings
SparkNavHost.kt - Custom model form → Model list state: adds model
SparkNavHost.kt - Model list state → Model repository: requests model actions
ModelListViewModel.kt - Model repository → Model catalog: loads bundled entries
ModelRepository.kt - Model catalog → Bundled catalog data: reads
ModelCatalog.kt - Model repository → App settings: reads custom models
ModelRepository.kt - Model repository → Model downloader: manages downloads
ModelRepository.kt - Model downloader → Model hosting service: fetches model
ModelDownloadManager.kt - Model downloader → Local model files: writes model files
ModelDownloadManager.kt - Chat interface → Chat orchestration: sends chat actions
ChatScreen.kt - Chat orchestration → Model repository: gets model path
ChatViewModel.kt - Chat orchestration → Chat history store: loads and saves
ChatViewModel.kt - Chat history store → Chat messages: serializes
ChatHistoryStore.kt - Chat orchestration → Inference engine: formats and generates
ChatViewModel.kt - Inference engine → JNI bridge: calls native API
InferenceEngine.kt - JNI bridge → Native inference bridge: bridges JNI calls
README.md - Settings interface → Settings state: observes settings
SettingsScreen.kt - Settings state → App settings: updates preferences
SettingsViewModel.kt - Application services → App settings: creates
SparkApplication.kt - Application services → Chat history store: creates
SparkApplication.kt - Application services → Model downloader: creates
SparkApplication.kt - Application services → Model repository: creates
SparkApplication.kt - Application services → Inference engine: creates
SparkApplication.kt - Application services → JNI bridge: initializes backend
SparkApplication.kt