diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/local/AppDatabase.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/db/AppDatabase.kt similarity index 80% rename from examples/llama.android/app/src/main/java/com/example/llama/data/local/AppDatabase.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/db/AppDatabase.kt index 10140bc942..bce0c6ad78 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/local/AppDatabase.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/db/AppDatabase.kt @@ -1,13 +1,13 @@ -package com.example.llama.data.local +package com.example.llama.data.db import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase -import com.example.llama.data.local.dao.ModelDao -import com.example.llama.data.local.dao.SystemPromptDao -import com.example.llama.data.local.entity.ModelEntity -import com.example.llama.data.local.entity.SystemPromptEntity +import com.example.llama.data.db.dao.ModelDao +import com.example.llama.data.db.dao.SystemPromptDao +import com.example.llama.data.db.entity.ModelEntity +import com.example.llama.data.db.entity.SystemPromptEntity import javax.inject.Singleton /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/local/converter/GgufMetadataConverters.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/db/converter/GgufMetadataConverters.kt similarity index 91% rename from examples/llama.android/app/src/main/java/com/example/llama/data/local/converter/GgufMetadataConverters.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/db/converter/GgufMetadataConverters.kt index 7c3e2a85ef..6ed15a1373 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/local/converter/GgufMetadataConverters.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/db/converter/GgufMetadataConverters.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.local.converter +package com.example.llama.data.db.converter import androidx.room.TypeConverter import com.example.llama.data.model.GgufMetadata diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/ModelDao.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/db/dao/ModelDao.kt similarity index 90% rename from examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/ModelDao.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/db/dao/ModelDao.kt index c74b140c71..89150d1153 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/ModelDao.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/db/dao/ModelDao.kt @@ -1,11 +1,11 @@ -package com.example.llama.data.local.dao +package com.example.llama.data.db.dao import androidx.room.Dao import androidx.room.Delete import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query -import com.example.llama.data.local.entity.ModelEntity +import com.example.llama.data.db.entity.ModelEntity import kotlinx.coroutines.flow.Flow @Dao diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/SystemPromptDao.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/db/dao/SystemPromptDao.kt similarity index 93% rename from examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/SystemPromptDao.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/db/dao/SystemPromptDao.kt index 1e064b61db..7c45e69fb4 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/SystemPromptDao.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/db/dao/SystemPromptDao.kt @@ -1,11 +1,11 @@ -package com.example.llama.data.local.dao +package com.example.llama.data.db.dao import androidx.room.Dao import androidx.room.Delete import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query -import com.example.llama.data.local.entity.SystemPromptEntity +import com.example.llama.data.db.entity.SystemPromptEntity import kotlinx.coroutines.flow.Flow /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/ModelEntity.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/db/entity/ModelEntity.kt similarity index 86% rename from examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/ModelEntity.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/db/entity/ModelEntity.kt index ebd590053e..340e95eeee 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/ModelEntity.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/db/entity/ModelEntity.kt @@ -1,9 +1,9 @@ -package com.example.llama.data.local.entity +package com.example.llama.data.db.entity import androidx.room.Entity import androidx.room.PrimaryKey import androidx.room.TypeConverters -import com.example.llama.data.local.converter.GgufMetadataConverters +import com.example.llama.data.db.converter.GgufMetadataConverters import com.example.llama.data.model.ModelInfo import com.example.llama.data.model.GgufMetadata diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/SystemPromptEntity.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/db/entity/SystemPromptEntity.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/SystemPromptEntity.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/db/entity/SystemPromptEntity.kt index 675c7cd6f0..253ad081ca 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/SystemPromptEntity.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/db/entity/SystemPromptEntity.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.local.entity +package com.example.llama.data.db.entity import androidx.room.Entity import androidx.room.PrimaryKey diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/repository/ModelRepository.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/repo/ModelRepository.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/data/repository/ModelRepository.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/repo/ModelRepository.kt index 3511365c4f..beeb47b0b0 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/repository/ModelRepository.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/repo/ModelRepository.kt @@ -1,19 +1,19 @@ -package com.example.llama.data.repository +package com.example.llama.data.repo import android.content.Context import android.llama.cpp.gguf.GgufMetadataReader import android.net.Uri import android.os.StatFs import android.util.Log -import com.example.llama.data.local.dao.ModelDao -import com.example.llama.data.local.entity.ModelEntity +import com.example.llama.data.db.dao.ModelDao +import com.example.llama.data.db.entity.ModelEntity import com.example.llama.data.model.GgufMetadata import com.example.llama.data.model.ModelInfo -import com.example.llama.data.remote.HuggingFaceDownloadInfo -import com.example.llama.data.remote.HuggingFaceModel -import com.example.llama.data.remote.HuggingFaceModelDetails -import com.example.llama.data.remote.HuggingFaceRemoteDataSource -import com.example.llama.data.repository.ModelRepository.ImportProgressTracker +import com.example.llama.data.source.remote.HuggingFaceDownloadInfo +import com.example.llama.data.source.remote.HuggingFaceModel +import com.example.llama.data.source.remote.HuggingFaceModelDetails +import com.example.llama.data.source.remote.HuggingFaceRemoteDataSource +import com.example.llama.data.repo.ModelRepository.ImportProgressTracker import com.example.llama.monitoring.StorageMetrics import com.example.llama.util.copyWithBuffer import com.example.llama.util.copyWithChannels diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/repository/SystemPromptRepository.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/repo/SystemPromptRepository.kt similarity index 95% rename from examples/llama.android/app/src/main/java/com/example/llama/data/repository/SystemPromptRepository.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/repo/SystemPromptRepository.kt index 05a3e20a63..925f55ec1f 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/repository/SystemPromptRepository.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/repo/SystemPromptRepository.kt @@ -1,7 +1,7 @@ -package com.example.llama.data.repository +package com.example.llama.data.repo -import com.example.llama.data.local.dao.SystemPromptDao -import com.example.llama.data.local.entity.SystemPromptEntity +import com.example.llama.data.db.dao.SystemPromptDao +import com.example.llama.data.db.entity.SystemPromptEntity import com.example.llama.data.model.SystemPrompt import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/preferences/UserPreferences.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/source/prefs/UserPreferences.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/data/preferences/UserPreferences.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/source/prefs/UserPreferences.kt index ec15c94c29..a1f72c3fe7 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/preferences/UserPreferences.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/source/prefs/UserPreferences.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.preferences +package com.example.llama.data.source.prefs import android.content.Context import androidx.datastore.core.DataStore diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/GatedTypeAdapter.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/GatedTypeAdapter.kt similarity index 94% rename from examples/llama.android/app/src/main/java/com/example/llama/data/remote/GatedTypeAdapter.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/GatedTypeAdapter.kt index a6206f1143..a1366235c0 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/GatedTypeAdapter.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/GatedTypeAdapter.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.remote +package com.example.llama.data.source.remote import com.google.gson.JsonDeserializationContext import com.google.gson.JsonDeserializer diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceApiService.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceApiService.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceApiService.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceApiService.kt index 11398e41b6..9853733609 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceApiService.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceApiService.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.remote +package com.example.llama.data.source.remote import okhttp3.ResponseBody import retrofit2.Response diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceModel.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceModel.kt index 71f0364b95..350a1c6505 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceModel.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.remote +package com.example.llama.data.source.remote import android.net.Uri import androidx.core.net.toUri diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModelDetails.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceModelDetails.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModelDetails.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceModelDetails.kt index ff6cc7cfeb..ab7dcc38eb 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModelDetails.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceModelDetails.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.remote +package com.example.llama.data.source.remote import java.util.Date diff --git a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceRemoteDataSource.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceRemoteDataSource.kt similarity index 99% rename from examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceRemoteDataSource.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceRemoteDataSource.kt index b26fb3d95a..9d5fcffb36 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceRemoteDataSource.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/source/remote/HuggingFaceRemoteDataSource.kt @@ -1,4 +1,4 @@ -package com.example.llama.data.remote +package com.example.llama.data.source.remote import android.app.DownloadManager import android.content.Context diff --git a/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt b/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt index 202114d1c9..8ca4854bb5 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt @@ -5,15 +5,15 @@ import android.llama.cpp.InferenceEngine import android.llama.cpp.KleidiLlama import android.llama.cpp.TierDetection import android.llama.cpp.gguf.GgufMetadataReader -import com.example.llama.data.local.AppDatabase -import com.example.llama.data.remote.GatedTypeAdapter -import com.example.llama.data.remote.HuggingFaceApiService -import com.example.llama.data.remote.HuggingFaceRemoteDataSource -import com.example.llama.data.remote.HuggingFaceRemoteDataSourceImpl -import com.example.llama.data.repository.ModelRepository -import com.example.llama.data.repository.ModelRepositoryImpl -import com.example.llama.data.repository.SystemPromptRepository -import com.example.llama.data.repository.SystemPromptRepositoryImpl +import com.example.llama.data.db.AppDatabase +import com.example.llama.data.source.remote.GatedTypeAdapter +import com.example.llama.data.source.remote.HuggingFaceApiService +import com.example.llama.data.source.remote.HuggingFaceRemoteDataSource +import com.example.llama.data.source.remote.HuggingFaceRemoteDataSourceImpl +import com.example.llama.data.repo.ModelRepository +import com.example.llama.data.repo.ModelRepositoryImpl +import com.example.llama.data.repo.SystemPromptRepository +import com.example.llama.data.repo.SystemPromptRepositoryImpl import com.example.llama.engine.BenchmarkService import com.example.llama.engine.ConversationService import com.example.llama.engine.InferenceService diff --git a/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt index caf6d45798..1c74787bcd 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt @@ -52,7 +52,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.window.DialogProperties import com.example.llama.data.model.ModelInfo -import com.example.llama.data.remote.HuggingFaceModel +import com.example.llama.data.source.remote.HuggingFaceModel import com.example.llama.ui.components.InfoView import com.example.llama.ui.components.ModelCardFullExpandable import com.example.llama.ui.scaffold.ScaffoldEvent diff --git a/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt index d3bc1e5334..844acaec0c 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.core.net.toUri import com.example.llama.APP_NAME -import com.example.llama.data.preferences.UserPreferences +import com.example.llama.data.source.prefs.UserPreferences import com.example.llama.ui.components.ArmFeaturesVisualizer import com.example.llama.viewmodel.SettingsViewModel diff --git a/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt index 9103cf8399..6240e79c02 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalView import androidx.core.view.WindowCompat -import com.example.llama.data.preferences.UserPreferences +import com.example.llama.data.source.prefs.UserPreferences import com.google.accompanist.systemuicontroller.rememberSystemUiController // TODO-han.yin: support more / custom color palettes? diff --git a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt index 87ce3fff8d..671ae2f69a 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt @@ -2,8 +2,8 @@ package com.example.llama.viewmodel import androidx.lifecycle.viewModelScope import com.example.llama.data.model.SystemPrompt -import com.example.llama.data.repository.ModelRepository -import com.example.llama.data.repository.SystemPromptRepository +import com.example.llama.data.repo.ModelRepository +import com.example.llama.data.repo.SystemPromptRepository import com.example.llama.engine.ModelLoadingMetrics import com.example.llama.engine.ModelLoadingService import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt index c7b8d10eb7..5a7707adde 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt @@ -11,7 +11,7 @@ import com.example.llama.data.model.ModelSortOrder import com.example.llama.data.model.filterBy import com.example.llama.data.model.queryBy import com.example.llama.data.model.sortByOrder -import com.example.llama.data.repository.ModelRepository +import com.example.llama.data.repo.ModelRepository import com.example.llama.engine.InferenceService import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.FlowPreview diff --git a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt index dea30c0f49..927fb18d9d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt @@ -15,10 +15,10 @@ import com.example.llama.data.model.ModelInfo import com.example.llama.data.model.ModelSortOrder import com.example.llama.data.model.filterBy import com.example.llama.data.model.sortByOrder -import com.example.llama.data.remote.HuggingFaceDownloadInfo -import com.example.llama.data.remote.HuggingFaceModel -import com.example.llama.data.repository.InsufficientStorageException -import com.example.llama.data.repository.ModelRepository +import com.example.llama.data.source.remote.HuggingFaceDownloadInfo +import com.example.llama.data.source.remote.HuggingFaceModel +import com.example.llama.data.repo.InsufficientStorageException +import com.example.llama.data.repo.ModelRepository import com.example.llama.util.formatFileByteSize import com.example.llama.util.getFileNameFromUri import com.example.llama.util.getFileSizeFromUri diff --git a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt index 7105d57c80..da3af20946 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt @@ -4,8 +4,8 @@ import android.llama.cpp.LLamaTier import android.llama.cpp.TierDetection import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.example.llama.data.preferences.UserPreferences -import com.example.llama.data.repository.ModelRepository +import com.example.llama.data.source.prefs.UserPreferences +import com.example.llama.data.repo.ModelRepository import com.example.llama.monitoring.BatteryMetrics import com.example.llama.monitoring.MemoryMetrics import com.example.llama.monitoring.PerformanceMonitor