From 72822f02364b3da215fbbd362a99a4dd8048b1fd Mon Sep 17 00:00:00 2001 From: Han Yin Date: Thu, 26 Jun 2025 13:06:48 -0700 Subject: [PATCH] misc: reorg the pkg structure --- .../app/src/main/AndroidManifest.xml | 13 +- .../{revamp => }/KleidiLlamaApplication.kt | 2 +- .../llama/{revamp => }/MainActivity.kt | 52 +++--- .../{revamp => }/data/local/AppDatabase.kt | 10 +- .../local/converter/GgufMetadataConverters.kt | 4 +- .../{revamp => }/data/local/dao/ModelDao.kt | 4 +- .../data/local/dao/SystemPromptDao.kt | 4 +- .../data/local/entity/ModelEntity.kt | 8 +- .../data/local/entity/SystemPromptEntity.kt | 4 +- .../{revamp => }/data/model/ModelInfo.kt | 10 +- .../{revamp => }/data/model/SystemPrompt.kt | 2 +- .../data/preferences/UserPreferences.kt | 2 +- .../data/remote/HuggingFaceApiService.kt | 2 +- .../data/remote/HuggingFaceModel.kt | 2 +- .../remote/HuggingFaceRemoteDataSource.kt | 2 +- .../data/repository/ModelRepository.kt | 30 ++-- .../data/repository/SystemPromptRepository.kt | 16 +- .../llama/{revamp => }/di/AppModule.kt | 32 ++-- .../{revamp => }/engine/InferenceServices.kt | 4 +- .../engine/StubInferenceEngine.kt | 4 +- .../com/example/llama/legacy/Downloadable.kt | 119 ------------- .../example/llama/legacy/LegacyActivity.kt | 162 ------------------ .../example/llama/legacy/LegacyViewModel.kt | 121 ------------- .../com/example/llama/legacy/theme/Color.kt | 11 -- .../com/example/llama/legacy/theme/Theme.kt | 70 -------- .../com/example/llama/legacy/theme/Type.kt | 34 ---- .../monitoring/PerformanceMonitor.kt | 2 +- .../{revamp => }/monitoring/SystemMetrics.kt | 2 +- .../navigation/AppDestinations.kt | 4 +- .../{revamp => }/ui/components/InfoView.kt | 2 +- .../{revamp => }/ui/components/ModelCards.kt | 6 +- .../ui/components/ModelUnloadDialogHandler.kt | 4 +- .../ui/scaffold/AnimatedNavHost.kt | 2 +- .../{revamp => }/ui/scaffold/AppScaffold.kt | 22 +-- .../ui/scaffold/NavigationDrawer.kt | 8 +- .../scaffold/bottombar/BenchmarkBottomBar.kt | 2 +- .../ui/scaffold/bottombar/BottomBarConfig.kt | 8 +- .../bottombar/ConversationBottomBar.kt | 4 +- .../bottombar/ModelSelectionBottomBar.kt | 4 +- .../bottombar/ModelsManagementBottomBar.kt | 4 +- .../ui/scaffold/topbar/DefaultTopBar.kt | 2 +- .../ui/scaffold/topbar/PerformanceTopBar.kt | 8 +- .../ui/scaffold/topbar/StorageTopBar.kt | 4 +- .../ui/scaffold/topbar/TopBarConfig.kt | 8 +- .../ui/screens/BenchmarkScreen.kt | 22 +-- .../ui/screens/ConversationScreen.kt | 22 +-- .../ui/screens/ModelDetailsScreen.kt | 12 +- .../ui/screens/ModelLoadingScreen.kt | 14 +- .../ui/screens/ModelSelectionScreen.kt | 10 +- .../ui/screens/ModelsManagementScreen.kt | 20 +-- .../ui/screens/SettingsGeneralScreen.kt | 8 +- .../llama/{revamp => }/ui/theme/Color.kt | 2 +- .../llama/{revamp => }/ui/theme/Shape.kt | 2 +- .../llama/{revamp => }/ui/theme/Theme.kt | 4 +- .../llama/{revamp => }/ui/theme/Type.kt | 2 +- .../llama/{revamp => }/util/FileUtils.kt | 2 +- .../llama/{revamp => }/util/FormatUtils.kt | 2 +- .../llama/{revamp => }/util/GgufMetadata.kt | 2 +- .../{revamp => }/util/GgufMetadataReader.kt | 2 +- .../util/NaiveMetadataExtractor.kt | 2 +- .../viewmodel/BenchmarkViewModel.kt | 6 +- .../viewmodel/ConversationViewModel.kt | 8 +- .../{revamp => }/viewmodel/MainViewModel.kt | 4 +- .../viewmodel/ModelLoadingViewModel.kt | 12 +- .../viewmodel/ModelSelectionViewModel.kt | 18 +- .../viewmodel/ModelUnloadingViewModel.kt | 4 +- .../viewmodel/ModelsManagementViewModel.kt | 26 +-- .../viewmodel/SettingsViewModel.kt | 18 +- 68 files changed, 259 insertions(+), 785 deletions(-) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/KleidiLlamaApplication.kt (83%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/MainActivity.kt (93%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/local/AppDatabase.kt (78%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/local/converter/GgufMetadataConverters.kt (82%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/local/dao/ModelDao.kt (89%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/local/dao/SystemPromptDao.kt (92%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/local/entity/ModelEntity.kt (74%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/local/entity/SystemPromptEntity.kt (93%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/model/ModelInfo.kt (96%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/model/SystemPrompt.kt (99%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/preferences/UserPreferences.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/remote/HuggingFaceApiService.kt (95%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/remote/HuggingFaceModel.kt (86%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/remote/HuggingFaceRemoteDataSource.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/repository/ModelRepository.kt (94%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/data/repository/SystemPromptRepository.kt (87%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/di/AppModule.kt (74%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/engine/InferenceServices.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/engine/StubInferenceEngine.kt (99%) delete mode 100644 examples/llama.android/app/src/main/java/com/example/llama/legacy/Downloadable.kt delete mode 100644 examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyActivity.kt delete mode 100644 examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyViewModel.kt delete mode 100644 examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Color.kt delete mode 100644 examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Theme.kt delete mode 100644 examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Type.kt rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/monitoring/PerformanceMonitor.kt (99%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/monitoring/SystemMetrics.kt (95%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/navigation/AppDestinations.kt (95%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/components/InfoView.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/components/ModelCards.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/components/ModelUnloadDialogHandler.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/AnimatedNavHost.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/AppScaffold.kt (86%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/NavigationDrawer.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/bottombar/BenchmarkBottomBar.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/bottombar/BottomBarConfig.kt (93%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/bottombar/ConversationBottomBar.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/bottombar/ModelSelectionBottomBar.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/bottombar/ModelsManagementBottomBar.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/topbar/DefaultTopBar.kt (96%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/topbar/PerformanceTopBar.kt (95%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/topbar/StorageTopBar.kt (96%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/scaffold/topbar/TopBarConfig.kt (85%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/BenchmarkScreen.kt (90%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/ConversationScreen.kt (95%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/ModelDetailsScreen.kt (96%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/ModelLoadingScreen.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/ModelSelectionScreen.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/ModelsManagementScreen.kt (96%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/screens/SettingsGeneralScreen.kt (96%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/theme/Color.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/theme/Shape.kt (91%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/theme/Theme.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/ui/theme/Type.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/util/FileUtils.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/util/FormatUtils.kt (98%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/util/GgufMetadata.kt (99%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/util/GgufMetadataReader.kt (99%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/util/NaiveMetadataExtractor.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/BenchmarkViewModel.kt (94%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/ConversationViewModel.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/MainViewModel.kt (83%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/ModelLoadingViewModel.kt (90%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/ModelSelectionViewModel.kt (91%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/ModelUnloadingViewModel.kt (97%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/ModelsManagementViewModel.kt (92%) rename examples/llama.android/app/src/main/java/com/example/llama/{revamp => }/viewmodel/SettingsViewModel.kt (90%) diff --git a/examples/llama.android/app/src/main/AndroidManifest.xml b/examples/llama.android/app/src/main/AndroidManifest.xml index 9fe63c07e9..e85d4899b2 100644 --- a/examples/llama.android/app/src/main/AndroidManifest.xml +++ b/examples/llama.android/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ - - - - - - diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/KleidiLlamaApplication.kt b/examples/llama.android/app/src/main/java/com/example/llama/KleidiLlamaApplication.kt similarity index 83% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/KleidiLlamaApplication.kt rename to examples/llama.android/app/src/main/java/com/example/llama/KleidiLlamaApplication.kt index 287230b16c..3698e1fcb5 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/KleidiLlamaApplication.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/KleidiLlamaApplication.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp +package com.example.llama import android.app.Application import dagger.hilt.android.HiltAndroidApp diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/MainActivity.kt b/examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt similarity index 93% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/MainActivity.kt rename to examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt index ba84fa5320..6960e23b56 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/MainActivity.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp +package com.example.llama import android.app.Activity import android.content.ActivityNotFoundException @@ -32,31 +32,31 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import androidx.navigation.navArgument -import com.example.llama.revamp.engine.ModelLoadingMetrics -import com.example.llama.revamp.navigation.AppDestinations -import com.example.llama.revamp.navigation.NavigationActions -import com.example.llama.revamp.ui.scaffold.AnimatedNavHost -import com.example.llama.revamp.ui.scaffold.AppNavigationDrawer -import com.example.llama.revamp.ui.scaffold.AppScaffold -import com.example.llama.revamp.ui.scaffold.ScaffoldConfig -import com.example.llama.revamp.ui.scaffold.ScaffoldEvent -import com.example.llama.revamp.ui.scaffold.bottombar.BottomBarConfig -import com.example.llama.revamp.ui.scaffold.topbar.NavigationIcon -import com.example.llama.revamp.ui.scaffold.topbar.TopBarConfig -import com.example.llama.revamp.ui.screens.BenchmarkScreen -import com.example.llama.revamp.ui.screens.ConversationScreen -import com.example.llama.revamp.ui.screens.ModelLoadingScreen -import com.example.llama.revamp.ui.screens.ModelSelectionScreen -import com.example.llama.revamp.ui.screens.ModelsManagementScreen -import com.example.llama.revamp.ui.screens.SettingsGeneralScreen -import com.example.llama.revamp.ui.theme.LlamaTheme -import com.example.llama.revamp.viewmodel.BenchmarkViewModel -import com.example.llama.revamp.viewmodel.ConversationViewModel -import com.example.llama.revamp.viewmodel.MainViewModel -import com.example.llama.revamp.viewmodel.ModelLoadingViewModel -import com.example.llama.revamp.viewmodel.ModelSelectionViewModel -import com.example.llama.revamp.viewmodel.ModelsManagementViewModel -import com.example.llama.revamp.viewmodel.SettingsViewModel +import com.example.llama.engine.ModelLoadingMetrics +import com.example.llama.navigation.AppDestinations +import com.example.llama.navigation.NavigationActions +import com.example.llama.ui.scaffold.AnimatedNavHost +import com.example.llama.ui.scaffold.AppNavigationDrawer +import com.example.llama.ui.scaffold.AppScaffold +import com.example.llama.ui.scaffold.ScaffoldConfig +import com.example.llama.ui.scaffold.ScaffoldEvent +import com.example.llama.ui.scaffold.bottombar.BottomBarConfig +import com.example.llama.ui.scaffold.topbar.NavigationIcon +import com.example.llama.ui.scaffold.topbar.TopBarConfig +import com.example.llama.ui.screens.BenchmarkScreen +import com.example.llama.ui.screens.ConversationScreen +import com.example.llama.ui.screens.ModelLoadingScreen +import com.example.llama.ui.screens.ModelSelectionScreen +import com.example.llama.ui.screens.ModelsManagementScreen +import com.example.llama.ui.screens.SettingsGeneralScreen +import com.example.llama.ui.theme.LlamaTheme +import com.example.llama.viewmodel.BenchmarkViewModel +import com.example.llama.viewmodel.ConversationViewModel +import com.example.llama.viewmodel.MainViewModel +import com.example.llama.viewmodel.ModelLoadingViewModel +import com.example.llama.viewmodel.ModelSelectionViewModel +import com.example.llama.viewmodel.ModelsManagementViewModel +import com.example.llama.viewmodel.SettingsViewModel import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/AppDatabase.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/local/AppDatabase.kt similarity index 78% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/AppDatabase.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/local/AppDatabase.kt index 4a75781b09..10140bc942 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/AppDatabase.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/local/AppDatabase.kt @@ -1,13 +1,13 @@ -package com.example.llama.revamp.data.local +package com.example.llama.data.local import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase -import com.example.llama.revamp.data.local.dao.ModelDao -import com.example.llama.revamp.data.local.dao.SystemPromptDao -import com.example.llama.revamp.data.local.entity.ModelEntity -import com.example.llama.revamp.data.local.entity.SystemPromptEntity +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 javax.inject.Singleton /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/converter/GgufMetadataConverters.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/local/converter/GgufMetadataConverters.kt similarity index 82% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/converter/GgufMetadataConverters.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/local/converter/GgufMetadataConverters.kt index 96fab5fc63..8302f591dd 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/converter/GgufMetadataConverters.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/local/converter/GgufMetadataConverters.kt @@ -1,7 +1,7 @@ -package com.example.llama.revamp.data.local.converter +package com.example.llama.data.local.converter import androidx.room.TypeConverter -import com.example.llama.revamp.util.GgufMetadata +import com.example.llama.util.GgufMetadata import kotlinx.serialization.json.Json class GgufMetadataConverters { diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/dao/ModelDao.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/ModelDao.kt similarity index 89% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/dao/ModelDao.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/ModelDao.kt index 5e2785192c..c74b140c71 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/dao/ModelDao.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/ModelDao.kt @@ -1,11 +1,11 @@ -package com.example.llama.revamp.data.local.dao +package com.example.llama.data.local.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.revamp.data.local.entity.ModelEntity +import com.example.llama.data.local.entity.ModelEntity import kotlinx.coroutines.flow.Flow @Dao diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/dao/SystemPromptDao.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/SystemPromptDao.kt similarity index 92% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/dao/SystemPromptDao.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/SystemPromptDao.kt index 1de732e1e0..1e064b61db 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/dao/SystemPromptDao.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/local/dao/SystemPromptDao.kt @@ -1,11 +1,11 @@ -package com.example.llama.revamp.data.local.dao +package com.example.llama.data.local.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.revamp.data.local.entity.SystemPromptEntity +import com.example.llama.data.local.entity.SystemPromptEntity import kotlinx.coroutines.flow.Flow /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/entity/ModelEntity.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/ModelEntity.kt similarity index 74% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/entity/ModelEntity.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/ModelEntity.kt index 4ea8088e92..8bc65b30c7 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/entity/ModelEntity.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/ModelEntity.kt @@ -1,11 +1,11 @@ -package com.example.llama.revamp.data.local.entity +package com.example.llama.data.local.entity import androidx.room.Entity import androidx.room.PrimaryKey import androidx.room.TypeConverters -import com.example.llama.revamp.data.local.converter.GgufMetadataConverters -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.util.GgufMetadata +import com.example.llama.data.local.converter.GgufMetadataConverters +import com.example.llama.data.model.ModelInfo +import com.example.llama.util.GgufMetadata @Entity(tableName = "models") diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/entity/SystemPromptEntity.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/SystemPromptEntity.kt similarity index 93% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/entity/SystemPromptEntity.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/SystemPromptEntity.kt index 6e5897d0aa..675c7cd6f0 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/local/entity/SystemPromptEntity.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/local/entity/SystemPromptEntity.kt @@ -1,8 +1,8 @@ -package com.example.llama.revamp.data.local.entity +package com.example.llama.data.local.entity import androidx.room.Entity import androidx.room.PrimaryKey -import com.example.llama.revamp.data.model.SystemPrompt +import com.example.llama.data.model.SystemPrompt /** * Database entity for storing system prompts. diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/model/ModelInfo.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/model/ModelInfo.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/model/ModelInfo.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/model/ModelInfo.kt index 123bc06272..185ead092b 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/model/ModelInfo.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/model/ModelInfo.kt @@ -1,9 +1,9 @@ -package com.example.llama.revamp.data.model +package com.example.llama.data.model -import com.example.llama.revamp.util.FileType -import com.example.llama.revamp.util.GgufMetadata -import com.example.llama.revamp.util.formatContextLength -import com.example.llama.revamp.util.formatFileByteSize +import com.example.llama.util.FileType +import com.example.llama.util.GgufMetadata +import com.example.llama.util.formatContextLength +import com.example.llama.util.formatFileByteSize /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/model/SystemPrompt.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/model/SystemPrompt.kt similarity index 99% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/model/SystemPrompt.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/model/SystemPrompt.kt index 4dead52d36..f6ae365bbb 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/model/SystemPrompt.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/model/SystemPrompt.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.data.model +package com.example.llama.data.model import java.text.SimpleDateFormat import java.util.Date diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/preferences/UserPreferences.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/preferences/UserPreferences.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/preferences/UserPreferences.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/preferences/UserPreferences.kt index a69b00838a..cf87c04a00 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/preferences/UserPreferences.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/preferences/UserPreferences.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.data.preferences +package com.example.llama.data.preferences import android.content.Context import androidx.datastore.core.DataStore diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceApiService.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceApiService.kt similarity index 95% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceApiService.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceApiService.kt index 4e1973a0cc..fff89fee44 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceApiService.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceApiService.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.data.remote +package com.example.llama.data.remote import okhttp3.ResponseBody import retrofit2.http.GET diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModel.kt similarity index 86% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModel.kt index 95d8e64d89..b08f6ddea4 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceModel.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.data.remote +package com.example.llama.data.remote data class HuggingFaceModel( val id: String, diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceRemoteDataSource.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceRemoteDataSource.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceRemoteDataSource.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceRemoteDataSource.kt index 723a5a1bf3..8ecfb70dab 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/remote/HuggingFaceRemoteDataSource.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/remote/HuggingFaceRemoteDataSource.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.data.remote +package com.example.llama.data.remote import android.util.Log import kotlinx.coroutines.Dispatchers diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/repository/ModelRepository.kt similarity index 94% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/repository/ModelRepository.kt index 1c874eb1f9..91f89cf025 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/repository/ModelRepository.kt @@ -1,23 +1,23 @@ -package com.example.llama.revamp.data.repository +package com.example.llama.data.repository import android.content.Context import android.net.Uri import android.os.StatFs import android.util.Log -import com.example.llama.revamp.data.local.dao.ModelDao -import com.example.llama.revamp.data.local.entity.ModelEntity -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.data.remote.HuggingFaceModel -import com.example.llama.revamp.data.remote.HuggingFaceRemoteDataSource -import com.example.llama.revamp.data.repository.ModelRepository.ImportProgressTracker -import com.example.llama.revamp.monitoring.StorageMetrics -import com.example.llama.revamp.util.GgufMetadata -import com.example.llama.revamp.util.GgufMetadataReader -import com.example.llama.revamp.util.copyWithBuffer -import com.example.llama.revamp.util.copyWithChannels -import com.example.llama.revamp.util.formatFileByteSize -import com.example.llama.revamp.util.getFileNameFromUri -import com.example.llama.revamp.util.getFileSizeFromUri +import com.example.llama.data.local.dao.ModelDao +import com.example.llama.data.local.entity.ModelEntity +import com.example.llama.data.model.ModelInfo +import com.example.llama.data.remote.HuggingFaceModel +import com.example.llama.data.remote.HuggingFaceRemoteDataSource +import com.example.llama.data.repository.ModelRepository.ImportProgressTracker +import com.example.llama.monitoring.StorageMetrics +import com.example.llama.util.GgufMetadata +import com.example.llama.util.GgufMetadataReader +import com.example.llama.util.copyWithBuffer +import com.example.llama.util.copyWithChannels +import com.example.llama.util.formatFileByteSize +import com.example.llama.util.getFileNameFromUri +import com.example.llama.util.getFileSizeFromUri import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/SystemPromptRepository.kt b/examples/llama.android/app/src/main/java/com/example/llama/data/repository/SystemPromptRepository.kt similarity index 87% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/SystemPromptRepository.kt rename to examples/llama.android/app/src/main/java/com/example/llama/data/repository/SystemPromptRepository.kt index ef32801dea..05a3e20a63 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/SystemPromptRepository.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/data/repository/SystemPromptRepository.kt @@ -1,10 +1,11 @@ -package com.example.llama.revamp.data.repository +package com.example.llama.data.repository -import com.example.llama.revamp.data.local.dao.SystemPromptDao -import com.example.llama.revamp.data.local.entity.SystemPromptEntity -import com.example.llama.revamp.data.model.SystemPrompt +import com.example.llama.data.local.dao.SystemPromptDao +import com.example.llama.data.local.entity.SystemPromptEntity +import com.example.llama.data.model.SystemPrompt import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import java.util.UUID import javax.inject.Inject @@ -29,11 +30,10 @@ class SystemPromptRepositoryImpl @Inject constructor( /** * Get all preset prompts. + * + * For now, we'll just return the static list since we don't store presets in the database */ - override fun getPresetPrompts(): Flow> { - // For now, we'll just return the static list since we don't store presets in the database - return kotlinx.coroutines.flow.flowOf(SystemPrompt.STUB_PRESETS) - } + override fun getPresetPrompts(): Flow> = flowOf(SystemPrompt.STUB_PRESETS) /** * Get recent prompts from the database. diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/di/AppModule.kt b/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt similarity index 74% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/di/AppModule.kt rename to examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt index c0f22fff30..5914ec7a00 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/di/AppModule.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt @@ -1,23 +1,23 @@ -package com.example.llama.revamp.di +package com.example.llama.di import android.content.Context import android.llama.cpp.InferenceEngine import android.llama.cpp.LLamaLibraryLoader -import com.example.llama.revamp.data.local.AppDatabase -import com.example.llama.revamp.data.remote.HuggingFaceApiService -import com.example.llama.revamp.data.remote.HuggingFaceRemoteDataSource -import com.example.llama.revamp.data.remote.HuggingFaceRemoteDataSourceImpl -import com.example.llama.revamp.data.repository.ModelRepository -import com.example.llama.revamp.data.repository.ModelRepositoryImpl -import com.example.llama.revamp.data.repository.SystemPromptRepository -import com.example.llama.revamp.data.repository.SystemPromptRepositoryImpl -import com.example.llama.revamp.engine.BenchmarkService -import com.example.llama.revamp.engine.ConversationService -import com.example.llama.revamp.engine.InferenceService -import com.example.llama.revamp.engine.InferenceServiceImpl -import com.example.llama.revamp.engine.ModelLoadingService -import com.example.llama.revamp.engine.StubInferenceEngine -import com.example.llama.revamp.monitoring.PerformanceMonitor +import com.example.llama.data.local.AppDatabase +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.engine.BenchmarkService +import com.example.llama.engine.ConversationService +import com.example.llama.engine.InferenceService +import com.example.llama.engine.InferenceServiceImpl +import com.example.llama.engine.ModelLoadingService +import com.example.llama.engine.StubInferenceEngine +import com.example.llama.monitoring.PerformanceMonitor import dagger.Binds import dagger.Module import dagger.Provides diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/engine/InferenceServices.kt b/examples/llama.android/app/src/main/java/com/example/llama/engine/InferenceServices.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/engine/InferenceServices.kt rename to examples/llama.android/app/src/main/java/com/example/llama/engine/InferenceServices.kt index 7d0f791a57..201bfc6adf 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/engine/InferenceServices.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/engine/InferenceServices.kt @@ -1,9 +1,9 @@ -package com.example.llama.revamp.engine +package com.example.llama.engine import android.llama.cpp.InferenceEngine import android.llama.cpp.InferenceEngine.State import android.util.Log -import com.example.llama.revamp.data.model.ModelInfo +import com.example.llama.data.model.ModelInfo import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/engine/StubInferenceEngine.kt b/examples/llama.android/app/src/main/java/com/example/llama/engine/StubInferenceEngine.kt similarity index 99% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/engine/StubInferenceEngine.kt rename to examples/llama.android/app/src/main/java/com/example/llama/engine/StubInferenceEngine.kt index e280ae2f81..bd8fc1c365 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/engine/StubInferenceEngine.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/engine/StubInferenceEngine.kt @@ -1,9 +1,9 @@ -package com.example.llama.revamp.engine +package com.example.llama.engine import android.llama.cpp.InferenceEngine import android.llama.cpp.InferenceEngine.State import android.util.Log -import com.example.llama.revamp.APP_NAME +import com.example.llama.APP_NAME import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/examples/llama.android/app/src/main/java/com/example/llama/legacy/Downloadable.kt b/examples/llama.android/app/src/main/java/com/example/llama/legacy/Downloadable.kt deleted file mode 100644 index e616132fbb..0000000000 --- a/examples/llama.android/app/src/main/java/com/example/llama/legacy/Downloadable.kt +++ /dev/null @@ -1,119 +0,0 @@ -package com.example.llama.legacy - -import android.app.DownloadManager -import android.net.Uri -import android.util.Log -import androidx.compose.material3.Button -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableDoubleStateOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue -import androidx.core.database.getLongOrNull -import androidx.core.net.toUri -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch -import java.io.File - -data class Downloadable(val name: String, val source: Uri, val destination: File) { - companion object { - @JvmStatic - private val tag: String? = this::class.qualifiedName - - sealed interface State - data object Ready: State - data class Downloading(val id: Long): State - data class Downloaded(val downloadable: Downloadable): State - data class Error(val message: String): State - - @JvmStatic - @Composable - fun Button(viewModel: LegacyViewModel, dm: DownloadManager, item: Downloadable) { - var status: State by remember { - mutableStateOf( - if (item.destination.exists()) Downloaded(item) - else Ready - ) - } - var progress by remember { mutableDoubleStateOf(0.0) } - - val coroutineScope = rememberCoroutineScope() - - suspend fun waitForDownload(result: Downloading, item: Downloadable): State { - while (true) { - val cursor = dm.query(DownloadManager.Query().setFilterById(result.id)) - - if (cursor == null) { - Log.e(tag, "dm.query() returned null") - return Error("dm.query() returned null") - } - - if (!cursor.moveToFirst() || cursor.count < 1) { - cursor.close() - Log.i(tag, "cursor.moveToFirst() returned false or cursor.count < 1, download canceled?") - return Ready - } - - val pix = cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR) - val tix = cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES) - val sofar = cursor.getLongOrNull(pix) ?: 0 - val total = cursor.getLongOrNull(tix) ?: 1 - cursor.close() - - if (sofar == total) { - return Downloaded(item) - } - - progress = (sofar * 1.0) / total - - delay(1000L) - } - } - - fun onClick() { - when (val s = status) { - is Downloaded -> { - viewModel.load(item.destination.path) - } - - is Downloading -> { - coroutineScope.launch { - status = waitForDownload(s, item) - } - } - - else -> { - item.destination.delete() - - val request = DownloadManager.Request(item.source).apply { - setTitle("Downloading model") - setDescription("Downloading model: ${item.name}") - setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI) - setDestinationUri(item.destination.toUri()) - } - - viewModel.log("Saving ${item.name} to ${item.destination.path}") - Log.i(tag, "Saving ${item.name} to ${item.destination.path}") - - val id = dm.enqueue(request) - status = Downloading(id) - onClick() - } - } - } - - Button(onClick = { onClick() }, enabled = status !is Downloading) { - when (status) { - is Downloading -> Text(text = "Downloading ${(progress * 100).toInt()}%") - is Downloaded -> Text("Load ${item.name}") - is Ready -> Text("Download ${item.name}") - is Error -> Text("Download ${item.name}") - } - } - } - - } -} diff --git a/examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyActivity.kt b/examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyActivity.kt deleted file mode 100644 index 43b7a0ba0d..0000000000 --- a/examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyActivity.kt +++ /dev/null @@ -1,162 +0,0 @@ -package com.example.llama.legacy - -import android.app.ActivityManager -import android.app.DownloadManager -import android.content.ClipData -import android.content.ClipboardManager -import android.net.Uri -import android.os.Bundle -import android.os.StrictMode -import android.os.StrictMode.VmPolicy -import android.text.format.Formatter -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.activity.viewModels -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.items -import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material3.Button -import androidx.compose.material3.LocalContentColor -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.Surface -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import androidx.core.content.getSystemService -import com.example.llama.legacy.theme.LlamaAndroidTheme -import java.io.File - -class LegacyActivity( - activityManager: ActivityManager? = null, - downloadManager: DownloadManager? = null, - clipboardManager: ClipboardManager? = null, -) : ComponentActivity() { - private val TAG: String? = this::class.simpleName - - private val activityManager by lazy { activityManager ?: getSystemService()!! } - private val downloadManager by lazy { downloadManager ?: getSystemService()!! } - private val clipboardManager by lazy { - clipboardManager ?: getSystemService()!! - } - - private val viewModel: LegacyViewModel by viewModels() - - // Get a MemoryInfo object for the device's current memory status. - private fun availableMemory(): ActivityManager.MemoryInfo { - return ActivityManager.MemoryInfo().also { memoryInfo -> - activityManager.getMemoryInfo(memoryInfo) - } - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - StrictMode.setVmPolicy( - VmPolicy.Builder(StrictMode.getVmPolicy()) - .detectLeakedClosableObjects() - .build() - ) - - val free = Formatter.formatFileSize(this, availableMemory().availMem) - val total = Formatter.formatFileSize(this, availableMemory().totalMem) - - viewModel.log("Current memory: $free / $total") - viewModel.log("Downloads directory: ${getExternalFilesDir(null)}") - - val extFilesDir = getExternalFilesDir(null) - - val models = listOf( - Downloadable( - "Phi-2 7B (Q4_0, 1.6 GiB)", - Uri.parse("https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q4_0.gguf?download=true"), - File(extFilesDir, "phi-2-q4_0.gguf"), - ), - Downloadable( - "TinyLlama 1.1B (f16, 2.2 GiB)", - Uri.parse("https://huggingface.co/ggml-org/models/resolve/main/tinyllama-1.1b/ggml-model-f16.gguf?download=true"), - File(extFilesDir, "tinyllama-1.1-f16.gguf"), - ), - Downloadable( - "Phi 2 DPO (Q3_K_M, 1.48 GiB)", - Uri.parse("https://huggingface.co/TheBloke/phi-2-dpo-GGUF/resolve/main/phi-2-dpo.Q3_K_M.gguf?download=true"), - File(extFilesDir, "phi-2-dpo.Q3_K_M.gguf") - ), - Downloadable( - "Phi 4 mini instruct (Q4_0, 2.33 GiB)", - Uri.parse("https://huggingface.co/bartowski/microsoft_Phi-4-mini-instruct-GGUF/resolve/main/microsoft_Phi-4-mini-instruct-Q4_0.gguf?download=true"), - File(extFilesDir, "microsoft_Phi-4-mini-instruct-Q4_0.gguf") - ), - ) - - setContent { - LlamaAndroidTheme { - // A surface container using the 'background' color from the theme - Surface( - modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colorScheme.background - ) { - MainCompose( - viewModel, - clipboardManager, - downloadManager, - models, - ) - } - - } - } - } -} - -@Composable -fun MainCompose( - viewModel: LegacyViewModel, - clipboard: ClipboardManager, - dm: DownloadManager, - models: List -) { - Column { - val scrollState = rememberLazyListState() - - Box(modifier = Modifier.weight(1f)) { - LazyColumn(state = scrollState) { - items(viewModel.messages) { - Text( - it, - style = MaterialTheme.typography.bodyLarge.copy(color = LocalContentColor.current), - modifier = Modifier.padding(16.dp) - ) - } - } - } - - OutlinedTextField( - value = viewModel.message, - onValueChange = { viewModel.updateMessage(it) }, - label = { Text("Message") }, - ) - - Row { - Button({ viewModel.send() }) { Text("Send") } - Button({ viewModel.bench(8, 4, 1) }) { Text("Bench") } - Button({ viewModel.clear() }) { Text("Clear") } - Button({ - viewModel.messages.joinToString("\n").let { - clipboard.setPrimaryClip(ClipData.newPlainText("", it)) - } - }) { Text("Copy") } - Button({ viewModel.unload() }) { Text("Unload") } - } - - models.forEach { - Downloadable.Button(viewModel, dm, it) - } - } -} diff --git a/examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyViewModel.kt deleted file mode 100644 index cf17a71aec..0000000000 --- a/examples/llama.android/app/src/main/java/com/example/llama/legacy/LegacyViewModel.kt +++ /dev/null @@ -1,121 +0,0 @@ -package com.example.llama.legacy - -import android.content.Context -import android.llama.cpp.LLamaAndroid -import android.llama.cpp.LLamaLibraryLoader -import android.util.Log -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import kotlinx.coroutines.flow.catch -import kotlinx.coroutines.launch - -class LegacyViewModel(context: Context): ViewModel() { - companion object { - private val tag = LegacyViewModel::class.java.simpleName - - @JvmStatic - private val NanosPerSecond = 1_000_000_000.0 - } - - val llamaAndroid: LLamaAndroid = LLamaLibraryLoader.createInstance(context) - ?: throw InstantiationException("Cannot instantiate LlamaAndroid!") - - var messages by mutableStateOf(listOf("Initializing...")) - private set - - var message by mutableStateOf("") - private set - - override fun onCleared() { - super.onCleared() - - viewModelScope.launch { - try { - llamaAndroid.destroy() - } catch (exc: IllegalStateException) { - messages += exc.message!! - } - } - } - - fun send() { - val text = message - message = "" - - // Add to messages console. - messages += text - messages += "" - - viewModelScope.launch { - // TODO-hyin: implement format message - llamaAndroid.sendUserPrompt(message = text) - .catch { - Log.e(tag, "send() failed", it) - messages += it.message!! - } - .collect { messages = messages.dropLast(1) + (messages.last() + it) } - } - } - - fun bench(pp: Int, tg: Int, pl: Int, nr: Int = 1) { - viewModelScope.launch { - try { - val start = System.nanoTime() - val warmupResult = llamaAndroid.bench(pp, tg, pl, nr) - val end = System.nanoTime() - - messages += warmupResult - - val warmup = (end - start).toDouble() / NanosPerSecond - messages += "Warm up time: $warmup seconds, please wait..." - - if (warmup > 5.0) { - messages += "Warm up took too long, aborting benchmark" - return@launch - } - - messages += llamaAndroid.bench(512, 128, 1, 3) - } catch (exc: IllegalStateException) { - Log.e(tag, "bench() failed", exc) - messages += exc.message!! - } - } - } - - fun load(pathToModel: String) { - viewModelScope.launch { - try { - llamaAndroid.loadModel(pathToModel) - messages += "Loaded $pathToModel" - } catch (exc: IllegalStateException) { - Log.e(tag, "load() failed", exc) - messages += exc.message!! - } - } - } - - fun updateMessage(newMessage: String) { - message = newMessage - } - - fun clear() { - messages = listOf() - } - - fun log(message: String) { - messages += message - } - - fun unload() = - viewModelScope.launch { - try { - llamaAndroid.unloadModel() - } catch (exc: IllegalStateException) { - Log.e(tag, "unload() failed", exc) - messages += exc.message!! - } - } -} diff --git a/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Color.kt b/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Color.kt deleted file mode 100644 index 3abee381aa..0000000000 --- a/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Color.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.example.llama.legacy.theme - -import androidx.compose.ui.graphics.Color - -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Theme.kt b/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Theme.kt deleted file mode 100644 index 5d9800ff6c..0000000000 --- a/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Theme.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.example.llama.legacy.theme - -import android.app.Activity -import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme -import androidx.compose.material3.lightColorScheme -import androidx.compose.runtime.Composable -import androidx.compose.runtime.SideEffect -import androidx.compose.ui.graphics.toArgb -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalView -import androidx.core.view.WindowCompat - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80 -) - -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40 - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ -) - -@Composable -fun LlamaAndroidTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, - content: @Composable () -> Unit -) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - val view = LocalView.current - if (!view.isInEditMode) { - SideEffect { - val window = (view.context as Activity).window - window.statusBarColor = colorScheme.primary.toArgb() - WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme - } - } - - MaterialTheme( - colorScheme = colorScheme, - typography = Typography, - content = content - ) -} diff --git a/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Type.kt b/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Type.kt deleted file mode 100644 index 460569f5fc..0000000000 --- a/examples/llama.android/app/src/main/java/com/example/llama/legacy/theme/Type.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.example.llama.legacy.theme - -import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp - -// Set of Material typography styles to start with -val Typography = Typography( - bodyLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - lineHeight = 24.sp, - letterSpacing = 0.5.sp - ) - /* Other default text styles to override - titleLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = 0.sp - ), - labelSmall = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 16.sp, - letterSpacing = 0.5.sp - ) - */ -) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt b/examples/llama.android/app/src/main/java/com/example/llama/monitoring/PerformanceMonitor.kt similarity index 99% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt rename to examples/llama.android/app/src/main/java/com/example/llama/monitoring/PerformanceMonitor.kt index 4d1c0b8f61..a69a224e4e 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/monitoring/PerformanceMonitor.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.monitoring +package com.example.llama.monitoring import android.app.ActivityManager import android.content.Context diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/SystemMetrics.kt b/examples/llama.android/app/src/main/java/com/example/llama/monitoring/SystemMetrics.kt similarity index 95% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/SystemMetrics.kt rename to examples/llama.android/app/src/main/java/com/example/llama/monitoring/SystemMetrics.kt index b4e4f195ab..95e39c7a22 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/SystemMetrics.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/monitoring/SystemMetrics.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.monitoring +package com.example.llama.monitoring /** * Data class containing battery information. diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/navigation/AppDestinations.kt b/examples/llama.android/app/src/main/java/com/example/llama/navigation/AppDestinations.kt similarity index 95% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/navigation/AppDestinations.kt rename to examples/llama.android/app/src/main/java/com/example/llama/navigation/AppDestinations.kt index 9392dab2d2..38e7fad41a 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/navigation/AppDestinations.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/navigation/AppDestinations.kt @@ -1,7 +1,7 @@ -package com.example.llama.revamp.navigation +package com.example.llama.navigation import androidx.navigation.NavController -import com.example.llama.revamp.engine.ModelLoadingMetrics +import com.example.llama.engine.ModelLoadingMetrics /** * Navigation destinations for the app diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/InfoView.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/components/InfoView.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/InfoView.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/components/InfoView.kt index b885422b8e..6323b8b530 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/InfoView.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/components/InfoView.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.components +package com.example.llama.ui.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/ModelCards.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/components/ModelCards.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/ModelCards.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/components/ModelCards.kt index ebd5583601..25c768ea82 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/ModelCards.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/components/ModelCards.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.components +package com.example.llama.ui.components import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.expandVertically @@ -39,8 +39,8 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.util.languageCodeToFlagEmoji +import com.example.llama.data.model.ModelInfo +import com.example.llama.util.languageCodeToFlagEmoji import java.text.SimpleDateFormat import java.util.Date import java.util.Locale diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/ModelUnloadDialogHandler.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/components/ModelUnloadDialogHandler.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/ModelUnloadDialogHandler.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/components/ModelUnloadDialogHandler.kt index e67174bfcc..714a1fb712 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/components/ModelUnloadDialogHandler.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/components/ModelUnloadDialogHandler.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.components +package com.example.llama.ui.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -17,7 +17,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.example.llama.revamp.viewmodel.UnloadModelState +import com.example.llama.viewmodel.UnloadModelState /** * Reusable component for handling model unloading dialogs diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/AnimatedNavHost.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/AnimatedNavHost.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/AnimatedNavHost.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/AnimatedNavHost.kt index eb2e32e3c0..209bf6047b 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/AnimatedNavHost.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/AnimatedNavHost.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold +package com.example.llama.ui.scaffold import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.core.LinearOutSlowInEasing diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/AppScaffold.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/AppScaffold.kt similarity index 86% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/AppScaffold.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/AppScaffold.kt index 0093a5a8c1..6138f8fae0 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/AppScaffold.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/AppScaffold.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold +package com.example.llama.ui.scaffold import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.Scaffold @@ -7,16 +7,16 @@ import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable import androidx.compose.runtime.remember -import com.example.llama.revamp.ui.scaffold.bottombar.BenchmarkBottomBar -import com.example.llama.revamp.ui.scaffold.bottombar.BottomBarConfig -import com.example.llama.revamp.ui.scaffold.bottombar.ConversationBottomBar -import com.example.llama.revamp.ui.scaffold.bottombar.ModelSelectionBottomBar -import com.example.llama.revamp.ui.scaffold.bottombar.ModelsManagementBottomBar -import com.example.llama.revamp.ui.scaffold.topbar.DefaultTopBar -import com.example.llama.revamp.ui.scaffold.topbar.NavigationIcon -import com.example.llama.revamp.ui.scaffold.topbar.PerformanceTopBar -import com.example.llama.revamp.ui.scaffold.topbar.StorageTopBar -import com.example.llama.revamp.ui.scaffold.topbar.TopBarConfig +import com.example.llama.ui.scaffold.bottombar.BenchmarkBottomBar +import com.example.llama.ui.scaffold.bottombar.BottomBarConfig +import com.example.llama.ui.scaffold.bottombar.ConversationBottomBar +import com.example.llama.ui.scaffold.bottombar.ModelSelectionBottomBar +import com.example.llama.ui.scaffold.bottombar.ModelsManagementBottomBar +import com.example.llama.ui.scaffold.topbar.DefaultTopBar +import com.example.llama.ui.scaffold.topbar.NavigationIcon +import com.example.llama.ui.scaffold.topbar.PerformanceTopBar +import com.example.llama.ui.scaffold.topbar.StorageTopBar +import com.example.llama.ui.scaffold.topbar.TopBarConfig /** * Configuration of both [TopBarConfig] and [BottomBarConfig] diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/NavigationDrawer.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/NavigationDrawer.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/NavigationDrawer.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/NavigationDrawer.kt index 680304a45c..d905362aa6 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/NavigationDrawer.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/NavigationDrawer.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold +package com.example.llama.ui.scaffold import androidx.activity.compose.BackHandler import androidx.compose.foundation.clickable @@ -32,9 +32,9 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.example.llama.revamp.APP_NAME -import com.example.llama.revamp.navigation.AppDestinations -import com.example.llama.revamp.navigation.NavigationActions +import com.example.llama.APP_NAME +import com.example.llama.navigation.AppDestinations +import com.example.llama.navigation.NavigationActions import kotlinx.coroutines.launch /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/BenchmarkBottomBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BenchmarkBottomBar.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/BenchmarkBottomBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BenchmarkBottomBar.kt index c29b0a1cdc..933f23ef92 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/BenchmarkBottomBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BenchmarkBottomBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.bottombar +package com.example.llama.ui.scaffold.bottombar import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/BottomBarConfig.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt similarity index 93% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/BottomBarConfig.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt index cf07f7bed3..1e3bd5bdfe 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/BottomBarConfig.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt @@ -1,9 +1,9 @@ -package com.example.llama.revamp.ui.scaffold.bottombar +package com.example.llama.ui.scaffold.bottombar import androidx.compose.foundation.text.input.TextFieldState -import com.example.llama.revamp.data.model.ModelFilter -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.data.model.ModelSortOrder +import com.example.llama.data.model.ModelFilter +import com.example.llama.data.model.ModelInfo +import com.example.llama.data.model.ModelSortOrder /** * [BottomAppBar] configurations diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ConversationBottomBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ConversationBottomBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt index 14bbd36f13..95b1937256 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ConversationBottomBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.bottombar +package com.example.llama.ui.scaffold.bottombar import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -32,7 +32,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp -import com.example.llama.revamp.APP_NAME +import com.example.llama.APP_NAME @Composable fun ConversationBottomBar( diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ModelSelectionBottomBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ModelSelectionBottomBar.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ModelSelectionBottomBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ModelSelectionBottomBar.kt index d047e14e90..a8ee5dde65 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ModelSelectionBottomBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ModelSelectionBottomBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.bottombar +package com.example.llama.ui.scaffold.bottombar import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn @@ -30,7 +30,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.example.llama.revamp.data.model.ModelSortOrder +import com.example.llama.data.model.ModelSortOrder @Composable fun ModelSelectionBottomBar( diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ModelsManagementBottomBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ModelsManagementBottomBar.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ModelsManagementBottomBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ModelsManagementBottomBar.kt index 9d6ce59e9a..dea6c72df3 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/bottombar/ModelsManagementBottomBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ModelsManagementBottomBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.bottombar +package com.example.llama.ui.scaffold.bottombar import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -31,7 +31,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.example.llama.R -import com.example.llama.revamp.data.model.ModelSortOrder +import com.example.llama.data.model.ModelSortOrder @Composable fun ModelsManagementBottomBar( diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/DefaultTopBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/DefaultTopBar.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/DefaultTopBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/DefaultTopBar.kt index dd49f693be..06b1854e32 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/DefaultTopBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/DefaultTopBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.topbar +package com.example.llama.ui.scaffold.topbar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/PerformanceTopBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/PerformanceTopBar.kt similarity index 95% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/PerformanceTopBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/PerformanceTopBar.kt index dcad7e8277..bb074fd68d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/PerformanceTopBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/PerformanceTopBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.topbar +package com.example.llama.ui.scaffold.topbar import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -21,9 +21,9 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.example.llama.revamp.monitoring.MemoryMetrics -import com.example.llama.revamp.monitoring.TemperatureMetrics -import com.example.llama.revamp.monitoring.TemperatureWarningLevel +import com.example.llama.monitoring.MemoryMetrics +import com.example.llama.monitoring.TemperatureMetrics +import com.example.llama.monitoring.TemperatureWarningLevel import java.util.Locale @OptIn(ExperimentalMaterial3Api::class) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/StorageTopBar.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/StorageTopBar.kt index 248753cefe..00f54dc5a9 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/StorageTopBar.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.scaffold.topbar +package com.example.llama.ui.scaffold.topbar import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -18,7 +18,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.example.llama.revamp.monitoring.StorageMetrics +import com.example.llama.monitoring.StorageMetrics import java.util.Locale @OptIn(ExperimentalMaterial3Api::class) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/TopBarConfig.kt similarity index 85% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/TopBarConfig.kt index f870935b7a..9c2b18398e 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/topbar/TopBarConfig.kt @@ -1,8 +1,8 @@ -package com.example.llama.revamp.ui.scaffold.topbar +package com.example.llama.ui.scaffold.topbar -import com.example.llama.revamp.monitoring.MemoryMetrics -import com.example.llama.revamp.monitoring.StorageMetrics -import com.example.llama.revamp.monitoring.TemperatureMetrics +import com.example.llama.monitoring.MemoryMetrics +import com.example.llama.monitoring.StorageMetrics +import com.example.llama.monitoring.TemperatureMetrics /** * [TopAppBar] configurations diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/BenchmarkScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/BenchmarkScreen.kt similarity index 90% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/BenchmarkScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/BenchmarkScreen.kt index 4257bc01e6..1769c8584d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/BenchmarkScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/BenchmarkScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import android.llama.cpp.InferenceEngine.State import androidx.activity.compose.BackHandler @@ -34,16 +34,16 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.engine.ModelLoadingMetrics -import com.example.llama.revamp.ui.components.ModelCardContentArchitectureRow -import com.example.llama.revamp.ui.components.ModelCardContentContextRow -import com.example.llama.revamp.ui.components.ModelCardContentField -import com.example.llama.revamp.ui.components.ModelCardCoreExpandable -import com.example.llama.revamp.ui.components.ModelUnloadDialogHandler -import com.example.llama.revamp.ui.theme.MonospacedTextStyle -import com.example.llama.revamp.util.formatMilliSeconds -import com.example.llama.revamp.viewmodel.BenchmarkViewModel +import com.example.llama.data.model.ModelInfo +import com.example.llama.engine.ModelLoadingMetrics +import com.example.llama.ui.components.ModelCardContentArchitectureRow +import com.example.llama.ui.components.ModelCardContentContextRow +import com.example.llama.ui.components.ModelCardContentField +import com.example.llama.ui.components.ModelCardCoreExpandable +import com.example.llama.ui.components.ModelUnloadDialogHandler +import com.example.llama.ui.theme.MonospacedTextStyle +import com.example.llama.util.formatMilliSeconds +import com.example.llama.viewmodel.BenchmarkViewModel @Composable fun BenchmarkScreen( diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ConversationScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ConversationScreen.kt similarity index 95% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ConversationScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ConversationScreen.kt index fe3141ed33..e4769f576d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ConversationScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ConversationScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import android.llama.cpp.InferenceEngine.State import androidx.activity.compose.BackHandler @@ -51,16 +51,16 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.compose.LocalLifecycleOwner -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.engine.ModelLoadingMetrics -import com.example.llama.revamp.ui.components.ModelCardContentArchitectureRow -import com.example.llama.revamp.ui.components.ModelCardContentContextRow -import com.example.llama.revamp.ui.components.ModelCardContentField -import com.example.llama.revamp.ui.components.ModelCardCoreExpandable -import com.example.llama.revamp.ui.components.ModelUnloadDialogHandler -import com.example.llama.revamp.util.formatMilliSeconds -import com.example.llama.revamp.viewmodel.ConversationViewModel -import com.example.llama.revamp.viewmodel.Message +import com.example.llama.data.model.ModelInfo +import com.example.llama.engine.ModelLoadingMetrics +import com.example.llama.ui.components.ModelCardContentArchitectureRow +import com.example.llama.ui.components.ModelCardContentContextRow +import com.example.llama.ui.components.ModelCardContentField +import com.example.llama.ui.components.ModelCardCoreExpandable +import com.example.llama.ui.components.ModelUnloadDialogHandler +import com.example.llama.util.formatMilliSeconds +import com.example.llama.viewmodel.ConversationViewModel +import com.example.llama.viewmodel.Message import kotlinx.coroutines.launch /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelDetailsScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelDetailsScreen.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelDetailsScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelDetailsScreen.kt index 52bce55810..1d0a919c13 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelDetailsScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelDetailsScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -21,11 +21,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.ui.components.ModelCardContentArchitectureRow -import com.example.llama.revamp.ui.components.ModelCardContentContextRow -import com.example.llama.revamp.ui.components.ModelCardContentTitleRow -import com.example.llama.revamp.util.FileType +import com.example.llama.data.model.ModelInfo +import com.example.llama.ui.components.ModelCardContentArchitectureRow +import com.example.llama.ui.components.ModelCardContentContextRow +import com.example.llama.ui.components.ModelCardContentTitleRow +import com.example.llama.util.FileType import java.text.SimpleDateFormat import java.util.Date import java.util.Locale diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelLoadingScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelLoadingScreen.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelLoadingScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelLoadingScreen.kt index bba5589afc..0c9f5ec0bd 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelLoadingScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelLoadingScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import android.llama.cpp.InferenceEngine.State import androidx.activity.compose.BackHandler @@ -48,12 +48,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import com.example.llama.revamp.data.model.SystemPrompt -import com.example.llama.revamp.engine.ModelLoadingMetrics -import com.example.llama.revamp.ui.components.ModelCardCoreExpandable -import com.example.llama.revamp.ui.components.ModelUnloadDialogHandler -import com.example.llama.revamp.ui.scaffold.ScaffoldEvent -import com.example.llama.revamp.viewmodel.ModelLoadingViewModel +import com.example.llama.data.model.SystemPrompt +import com.example.llama.engine.ModelLoadingMetrics +import com.example.llama.ui.components.ModelCardCoreExpandable +import com.example.llama.ui.components.ModelUnloadDialogHandler +import com.example.llama.ui.scaffold.ScaffoldEvent +import com.example.llama.viewmodel.ModelLoadingViewModel enum class Mode { diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelSelectionScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelSelectionScreen.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelSelectionScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelSelectionScreen.kt index 8309fad703..640b136bee 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelSelectionScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelSelectionScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Arrangement @@ -40,10 +40,10 @@ import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.example.llama.revamp.ui.components.InfoAction -import com.example.llama.revamp.ui.components.InfoView -import com.example.llama.revamp.ui.components.ModelCardFullExpandable -import com.example.llama.revamp.viewmodel.ModelSelectionViewModel +import com.example.llama.ui.components.InfoAction +import com.example.llama.ui.components.InfoView +import com.example.llama.ui.components.ModelCardFullExpandable +import com.example.llama.viewmodel.ModelSelectionViewModel @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelsManagementScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelsManagementScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt index 0c6a6198bd..9c7b5a8fad 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/ModelsManagementScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/ModelsManagementScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Arrangement @@ -38,15 +38,15 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.window.DialogProperties -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.ui.components.InfoView -import com.example.llama.revamp.ui.components.ModelCardFullExpandable -import com.example.llama.revamp.ui.scaffold.ScaffoldEvent -import com.example.llama.revamp.util.formatFileByteSize -import com.example.llama.revamp.viewmodel.ModelManagementState -import com.example.llama.revamp.viewmodel.ModelManagementState.Deletion -import com.example.llama.revamp.viewmodel.ModelManagementState.Importation -import com.example.llama.revamp.viewmodel.ModelsManagementViewModel +import com.example.llama.data.model.ModelInfo +import com.example.llama.ui.components.InfoView +import com.example.llama.ui.components.ModelCardFullExpandable +import com.example.llama.ui.scaffold.ScaffoldEvent +import com.example.llama.util.formatFileByteSize +import com.example.llama.viewmodel.ModelManagementState +import com.example.llama.viewmodel.ModelManagementState.Deletion +import com.example.llama.viewmodel.ModelManagementState.Importation +import com.example.llama.viewmodel.ModelsManagementViewModel /** * Screen for managing LLM models (view, download, delete) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/SettingsGeneralScreen.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt similarity index 96% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/SettingsGeneralScreen.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt index d34f3e4205..5f9fbad12d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/screens/SettingsGeneralScreen.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/screens/SettingsGeneralScreen.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.screens +package com.example.llama.ui.screens import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -23,9 +23,9 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.example.llama.revamp.APP_NAME -import com.example.llama.revamp.data.preferences.UserPreferences -import com.example.llama.revamp.viewmodel.SettingsViewModel +import com.example.llama.APP_NAME +import com.example.llama.data.preferences.UserPreferences +import com.example.llama.viewmodel.SettingsViewModel /** * Screen for general app settings diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Color.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Color.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Color.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Color.kt index 4b53aedd97..92e4d594aa 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Color.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Color.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.theme +package com.example.llama.ui.theme import androidx.compose.ui.graphics.Color diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Shape.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Shape.kt similarity index 91% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Shape.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Shape.kt index a7e443556a..94d7421ae4 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Shape.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Shape.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.theme +package com.example.llama.ui.theme import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Shapes diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Theme.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Theme.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt index d913c03125..9103cf8399 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Theme.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Theme.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.theme +package com.example.llama.ui.theme import android.app.Activity import androidx.compose.foundation.isSystemInDarkTheme @@ -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.revamp.data.preferences.UserPreferences +import com.example.llama.data.preferences.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/revamp/ui/theme/Type.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Type.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Type.kt rename to examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Type.kt index f95a0b1424..b7453076bb 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/theme/Type.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/theme/Type.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.ui.theme +package com.example.llama.ui.theme import androidx.compose.material3.Typography import androidx.compose.ui.text.TextStyle diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/FileUtils.kt b/examples/llama.android/app/src/main/java/com/example/llama/util/FileUtils.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/util/FileUtils.kt rename to examples/llama.android/app/src/main/java/com/example/llama/util/FileUtils.kt index b19c5c7a55..ce9c4c3d8e 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/FileUtils.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/util/FileUtils.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.util +package com.example.llama.util import android.content.Context import android.net.Uri diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/FormatUtils.kt b/examples/llama.android/app/src/main/java/com/example/llama/util/FormatUtils.kt similarity index 98% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/util/FormatUtils.kt rename to examples/llama.android/app/src/main/java/com/example/llama/util/FormatUtils.kt index ba817dd832..fb795df678 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/FormatUtils.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/util/FormatUtils.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.util +package com.example.llama.util import java.util.Locale diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/GgufMetadata.kt b/examples/llama.android/app/src/main/java/com/example/llama/util/GgufMetadata.kt similarity index 99% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/util/GgufMetadata.kt rename to examples/llama.android/app/src/main/java/com/example/llama/util/GgufMetadata.kt index 41a6c2d74c..db26924a02 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/GgufMetadata.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/util/GgufMetadata.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.util +package com.example.llama.util import kotlinx.serialization.Serializable import java.io.IOException diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/GgufMetadataReader.kt b/examples/llama.android/app/src/main/java/com/example/llama/util/GgufMetadataReader.kt similarity index 99% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/util/GgufMetadataReader.kt rename to examples/llama.android/app/src/main/java/com/example/llama/util/GgufMetadataReader.kt index d13dbba0d7..242e4e70d3 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/GgufMetadataReader.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/util/GgufMetadataReader.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.util +package com.example.llama.util import java.io.File import java.io.InputStream diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/NaiveMetadataExtractor.kt b/examples/llama.android/app/src/main/java/com/example/llama/util/NaiveMetadataExtractor.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/util/NaiveMetadataExtractor.kt rename to examples/llama.android/app/src/main/java/com/example/llama/util/NaiveMetadataExtractor.kt index 2a0ff42627..ff20bff505 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/util/NaiveMetadataExtractor.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/util/NaiveMetadataExtractor.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.util +package com.example.llama.util import java.util.Locale diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/BenchmarkViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/BenchmarkViewModel.kt similarity index 94% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/BenchmarkViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/BenchmarkViewModel.kt index cc83d0d7f3..a086dfc46d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/BenchmarkViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/BenchmarkViewModel.kt @@ -1,9 +1,9 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import android.llama.cpp.isUninterruptible import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.engine.BenchmarkService +import com.example.llama.data.model.ModelInfo +import com.example.llama.engine.BenchmarkService import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ConversationViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ConversationViewModel.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ConversationViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ConversationViewModel.kt index 51777ed8f0..72c12b1375 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ConversationViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ConversationViewModel.kt @@ -1,11 +1,11 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.foundation.text.input.clearText import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.engine.ConversationService -import com.example.llama.revamp.engine.GenerationUpdate -import com.example.llama.revamp.engine.TokenMetrics +import com.example.llama.engine.ConversationService +import com.example.llama.engine.GenerationUpdate +import com.example.llama.engine.TokenMetrics import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Job diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/MainViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/MainViewModel.kt similarity index 83% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/MainViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/MainViewModel.kt index 6a70e1f9ec..0106341e50 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/MainViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/MainViewModel.kt @@ -1,7 +1,7 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import androidx.lifecycle.ViewModel -import com.example.llama.revamp.engine.InferenceService +import com.example.llama.engine.InferenceService import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelLoadingViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt similarity index 90% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelLoadingViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt index 9383f6ab5d..87ce3fff8d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelLoadingViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelLoadingViewModel.kt @@ -1,11 +1,11 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.data.model.SystemPrompt -import com.example.llama.revamp.data.repository.ModelRepository -import com.example.llama.revamp.data.repository.SystemPromptRepository -import com.example.llama.revamp.engine.ModelLoadingMetrics -import com.example.llama.revamp.engine.ModelLoadingService +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.engine.ModelLoadingMetrics +import com.example.llama.engine.ModelLoadingService import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelSelectionViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt similarity index 91% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelSelectionViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt index d0950d2a3b..c7b8d10eb7 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelSelectionViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelSelectionViewModel.kt @@ -1,18 +1,18 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.foundation.text.input.clearText import androidx.compose.runtime.snapshotFlow import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.data.model.ModelFilter -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.data.model.ModelSortOrder -import com.example.llama.revamp.data.model.filterBy -import com.example.llama.revamp.data.model.queryBy -import com.example.llama.revamp.data.model.sortByOrder -import com.example.llama.revamp.data.repository.ModelRepository -import com.example.llama.revamp.engine.InferenceService +import com.example.llama.data.model.ModelFilter +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.queryBy +import com.example.llama.data.model.sortByOrder +import com.example.llama.data.repository.ModelRepository +import com.example.llama.engine.InferenceService import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableStateFlow diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelUnloadingViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelUnloadingViewModel.kt similarity index 97% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelUnloadingViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelUnloadingViewModel.kt index 690cabc0b1..0a93a9851d 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelUnloadingViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelUnloadingViewModel.kt @@ -1,4 +1,4 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import android.llama.cpp.InferenceEngine import android.llama.cpp.InferenceEngine.State @@ -6,7 +6,7 @@ import android.llama.cpp.isModelLoaded import android.llama.cpp.isUninterruptible import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.engine.InferenceService +import com.example.llama.engine.InferenceService import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelsManagementViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt similarity index 92% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelsManagementViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt index 14386069d6..fef3533ad3 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/ModelsManagementViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/ModelsManagementViewModel.kt @@ -1,22 +1,22 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import android.content.Context import android.net.Uri import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.data.model.ModelFilter -import com.example.llama.revamp.data.model.ModelInfo -import com.example.llama.revamp.data.model.ModelSortOrder -import com.example.llama.revamp.data.model.filterBy -import com.example.llama.revamp.data.model.sortByOrder -import com.example.llama.revamp.data.remote.HuggingFaceModel -import com.example.llama.revamp.data.repository.InsufficientStorageException -import com.example.llama.revamp.data.repository.ModelRepository -import com.example.llama.revamp.util.getFileNameFromUri -import com.example.llama.revamp.util.getFileSizeFromUri -import com.example.llama.revamp.viewmodel.ModelManagementState.Deletion -import com.example.llama.revamp.viewmodel.ModelManagementState.Importation +import com.example.llama.data.model.ModelFilter +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.HuggingFaceModel +import com.example.llama.data.repository.InsufficientStorageException +import com.example.llama.data.repository.ModelRepository +import com.example.llama.util.getFileNameFromUri +import com.example.llama.util.getFileSizeFromUri +import com.example.llama.viewmodel.ModelManagementState.Deletion +import com.example.llama.viewmodel.ModelManagementState.Importation import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.delay diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt similarity index 90% rename from examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt rename to examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt index 0f42f31956..42011d5162 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/viewmodel/SettingsViewModel.kt @@ -1,15 +1,15 @@ -package com.example.llama.revamp.viewmodel +package com.example.llama.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.example.llama.revamp.data.preferences.UserPreferences -import com.example.llama.revamp.data.repository.ModelRepository -import com.example.llama.revamp.monitoring.BatteryMetrics -import com.example.llama.revamp.monitoring.MemoryMetrics -import com.example.llama.revamp.monitoring.PerformanceMonitor -import com.example.llama.revamp.monitoring.StorageMetrics -import com.example.llama.revamp.monitoring.TemperatureMetrics -import com.example.llama.revamp.monitoring.TemperatureWarningLevel +import com.example.llama.data.preferences.UserPreferences +import com.example.llama.data.repository.ModelRepository +import com.example.llama.monitoring.BatteryMetrics +import com.example.llama.monitoring.MemoryMetrics +import com.example.llama.monitoring.PerformanceMonitor +import com.example.llama.monitoring.StorageMetrics +import com.example.llama.monitoring.TemperatureMetrics +import com.example.llama.monitoring.TemperatureWarningLevel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow