misc: reorg the pkg structure
This commit is contained in:
parent
b59c59e5c3
commit
72822f0236
|
|
@ -5,7 +5,7 @@
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".revamp.KleidiLlamaApplication"
|
android:name=".KleidiLlamaApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
|
@ -17,16 +17,7 @@
|
||||||
>
|
>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".legacy.LegacyActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
|
||||||
android:theme="@style/Theme.LlamaAndroid">
|
|
||||||
<intent-filter>
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".revamp.MainActivity"
|
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.LlamaAndroid">
|
android:theme="@style/Theme.LlamaAndroid">
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp
|
package com.example.llama
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import dagger.hilt.android.HiltAndroidApp
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp
|
package com.example.llama
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
|
|
@ -32,31 +32,31 @@ import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import androidx.navigation.navArgument
|
import androidx.navigation.navArgument
|
||||||
import com.example.llama.revamp.engine.ModelLoadingMetrics
|
import com.example.llama.engine.ModelLoadingMetrics
|
||||||
import com.example.llama.revamp.navigation.AppDestinations
|
import com.example.llama.navigation.AppDestinations
|
||||||
import com.example.llama.revamp.navigation.NavigationActions
|
import com.example.llama.navigation.NavigationActions
|
||||||
import com.example.llama.revamp.ui.scaffold.AnimatedNavHost
|
import com.example.llama.ui.scaffold.AnimatedNavHost
|
||||||
import com.example.llama.revamp.ui.scaffold.AppNavigationDrawer
|
import com.example.llama.ui.scaffold.AppNavigationDrawer
|
||||||
import com.example.llama.revamp.ui.scaffold.AppScaffold
|
import com.example.llama.ui.scaffold.AppScaffold
|
||||||
import com.example.llama.revamp.ui.scaffold.ScaffoldConfig
|
import com.example.llama.ui.scaffold.ScaffoldConfig
|
||||||
import com.example.llama.revamp.ui.scaffold.ScaffoldEvent
|
import com.example.llama.ui.scaffold.ScaffoldEvent
|
||||||
import com.example.llama.revamp.ui.scaffold.bottombar.BottomBarConfig
|
import com.example.llama.ui.scaffold.bottombar.BottomBarConfig
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.NavigationIcon
|
import com.example.llama.ui.scaffold.topbar.NavigationIcon
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.TopBarConfig
|
import com.example.llama.ui.scaffold.topbar.TopBarConfig
|
||||||
import com.example.llama.revamp.ui.screens.BenchmarkScreen
|
import com.example.llama.ui.screens.BenchmarkScreen
|
||||||
import com.example.llama.revamp.ui.screens.ConversationScreen
|
import com.example.llama.ui.screens.ConversationScreen
|
||||||
import com.example.llama.revamp.ui.screens.ModelLoadingScreen
|
import com.example.llama.ui.screens.ModelLoadingScreen
|
||||||
import com.example.llama.revamp.ui.screens.ModelSelectionScreen
|
import com.example.llama.ui.screens.ModelSelectionScreen
|
||||||
import com.example.llama.revamp.ui.screens.ModelsManagementScreen
|
import com.example.llama.ui.screens.ModelsManagementScreen
|
||||||
import com.example.llama.revamp.ui.screens.SettingsGeneralScreen
|
import com.example.llama.ui.screens.SettingsGeneralScreen
|
||||||
import com.example.llama.revamp.ui.theme.LlamaTheme
|
import com.example.llama.ui.theme.LlamaTheme
|
||||||
import com.example.llama.revamp.viewmodel.BenchmarkViewModel
|
import com.example.llama.viewmodel.BenchmarkViewModel
|
||||||
import com.example.llama.revamp.viewmodel.ConversationViewModel
|
import com.example.llama.viewmodel.ConversationViewModel
|
||||||
import com.example.llama.revamp.viewmodel.MainViewModel
|
import com.example.llama.viewmodel.MainViewModel
|
||||||
import com.example.llama.revamp.viewmodel.ModelLoadingViewModel
|
import com.example.llama.viewmodel.ModelLoadingViewModel
|
||||||
import com.example.llama.revamp.viewmodel.ModelSelectionViewModel
|
import com.example.llama.viewmodel.ModelSelectionViewModel
|
||||||
import com.example.llama.revamp.viewmodel.ModelsManagementViewModel
|
import com.example.llama.viewmodel.ModelsManagementViewModel
|
||||||
import com.example.llama.revamp.viewmodel.SettingsViewModel
|
import com.example.llama.viewmodel.SettingsViewModel
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package com.example.llama.revamp.data.local
|
package com.example.llama.data.local
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import com.example.llama.revamp.data.local.dao.ModelDao
|
import com.example.llama.data.local.dao.ModelDao
|
||||||
import com.example.llama.revamp.data.local.dao.SystemPromptDao
|
import com.example.llama.data.local.dao.SystemPromptDao
|
||||||
import com.example.llama.revamp.data.local.entity.ModelEntity
|
import com.example.llama.data.local.entity.ModelEntity
|
||||||
import com.example.llama.revamp.data.local.entity.SystemPromptEntity
|
import com.example.llama.data.local.entity.SystemPromptEntity
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.example.llama.revamp.data.local.converter
|
package com.example.llama.data.local.converter
|
||||||
|
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import com.example.llama.revamp.util.GgufMetadata
|
import com.example.llama.util.GgufMetadata
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
class GgufMetadataConverters {
|
class GgufMetadataConverters {
|
||||||
|
|
@ -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.Dao
|
||||||
import androidx.room.Delete
|
import androidx.room.Delete
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
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
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
|
|
@ -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.Dao
|
||||||
import androidx.room.Delete
|
import androidx.room.Delete
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
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
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -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.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import com.example.llama.revamp.data.local.converter.GgufMetadataConverters
|
import com.example.llama.data.local.converter.GgufMetadataConverters
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.util.GgufMetadata
|
import com.example.llama.util.GgufMetadata
|
||||||
|
|
||||||
|
|
||||||
@Entity(tableName = "models")
|
@Entity(tableName = "models")
|
||||||
|
|
@ -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.Entity
|
||||||
import androidx.room.PrimaryKey
|
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.
|
* Database entity for storing system prompts.
|
||||||
|
|
@ -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.util.FileType
|
||||||
import com.example.llama.revamp.util.GgufMetadata
|
import com.example.llama.util.GgufMetadata
|
||||||
import com.example.llama.revamp.util.formatContextLength
|
import com.example.llama.util.formatContextLength
|
||||||
import com.example.llama.revamp.util.formatFileByteSize
|
import com.example.llama.util.formatFileByteSize
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.data.model
|
package com.example.llama.data.model
|
||||||
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.data.preferences
|
package com.example.llama.data.preferences
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.datastore.core.DataStore
|
import androidx.datastore.core.DataStore
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.data.remote
|
package com.example.llama.data.remote
|
||||||
|
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.data.remote
|
package com.example.llama.data.remote
|
||||||
|
|
||||||
data class HuggingFaceModel(
|
data class HuggingFaceModel(
|
||||||
val id: String,
|
val id: String,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.data.remote
|
package com.example.llama.data.remote
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
package com.example.llama.revamp.data.repository
|
package com.example.llama.data.repository
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.StatFs
|
import android.os.StatFs
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.example.llama.revamp.data.local.dao.ModelDao
|
import com.example.llama.data.local.dao.ModelDao
|
||||||
import com.example.llama.revamp.data.local.entity.ModelEntity
|
import com.example.llama.data.local.entity.ModelEntity
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.data.remote.HuggingFaceModel
|
import com.example.llama.data.remote.HuggingFaceModel
|
||||||
import com.example.llama.revamp.data.remote.HuggingFaceRemoteDataSource
|
import com.example.llama.data.remote.HuggingFaceRemoteDataSource
|
||||||
import com.example.llama.revamp.data.repository.ModelRepository.ImportProgressTracker
|
import com.example.llama.data.repository.ModelRepository.ImportProgressTracker
|
||||||
import com.example.llama.revamp.monitoring.StorageMetrics
|
import com.example.llama.monitoring.StorageMetrics
|
||||||
import com.example.llama.revamp.util.GgufMetadata
|
import com.example.llama.util.GgufMetadata
|
||||||
import com.example.llama.revamp.util.GgufMetadataReader
|
import com.example.llama.util.GgufMetadataReader
|
||||||
import com.example.llama.revamp.util.copyWithBuffer
|
import com.example.llama.util.copyWithBuffer
|
||||||
import com.example.llama.revamp.util.copyWithChannels
|
import com.example.llama.util.copyWithChannels
|
||||||
import com.example.llama.revamp.util.formatFileByteSize
|
import com.example.llama.util.formatFileByteSize
|
||||||
import com.example.llama.revamp.util.getFileNameFromUri
|
import com.example.llama.util.getFileNameFromUri
|
||||||
import com.example.llama.revamp.util.getFileSizeFromUri
|
import com.example.llama.util.getFileSizeFromUri
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|
@ -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.data.local.dao.SystemPromptDao
|
||||||
import com.example.llama.revamp.data.local.entity.SystemPromptEntity
|
import com.example.llama.data.local.entity.SystemPromptEntity
|
||||||
import com.example.llama.revamp.data.model.SystemPrompt
|
import com.example.llama.data.model.SystemPrompt
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
|
import kotlinx.coroutines.flow.flowOf
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
@ -29,11 +30,10 @@ class SystemPromptRepositoryImpl @Inject constructor(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all preset prompts.
|
* 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<List<SystemPrompt>> {
|
override fun getPresetPrompts(): Flow<List<SystemPrompt>> = flowOf(SystemPrompt.STUB_PRESETS)
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get recent prompts from the database.
|
* Get recent prompts from the database.
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
package com.example.llama.revamp.di
|
package com.example.llama.di
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.llama.cpp.InferenceEngine
|
import android.llama.cpp.InferenceEngine
|
||||||
import android.llama.cpp.LLamaLibraryLoader
|
import android.llama.cpp.LLamaLibraryLoader
|
||||||
import com.example.llama.revamp.data.local.AppDatabase
|
import com.example.llama.data.local.AppDatabase
|
||||||
import com.example.llama.revamp.data.remote.HuggingFaceApiService
|
import com.example.llama.data.remote.HuggingFaceApiService
|
||||||
import com.example.llama.revamp.data.remote.HuggingFaceRemoteDataSource
|
import com.example.llama.data.remote.HuggingFaceRemoteDataSource
|
||||||
import com.example.llama.revamp.data.remote.HuggingFaceRemoteDataSourceImpl
|
import com.example.llama.data.remote.HuggingFaceRemoteDataSourceImpl
|
||||||
import com.example.llama.revamp.data.repository.ModelRepository
|
import com.example.llama.data.repository.ModelRepository
|
||||||
import com.example.llama.revamp.data.repository.ModelRepositoryImpl
|
import com.example.llama.data.repository.ModelRepositoryImpl
|
||||||
import com.example.llama.revamp.data.repository.SystemPromptRepository
|
import com.example.llama.data.repository.SystemPromptRepository
|
||||||
import com.example.llama.revamp.data.repository.SystemPromptRepositoryImpl
|
import com.example.llama.data.repository.SystemPromptRepositoryImpl
|
||||||
import com.example.llama.revamp.engine.BenchmarkService
|
import com.example.llama.engine.BenchmarkService
|
||||||
import com.example.llama.revamp.engine.ConversationService
|
import com.example.llama.engine.ConversationService
|
||||||
import com.example.llama.revamp.engine.InferenceService
|
import com.example.llama.engine.InferenceService
|
||||||
import com.example.llama.revamp.engine.InferenceServiceImpl
|
import com.example.llama.engine.InferenceServiceImpl
|
||||||
import com.example.llama.revamp.engine.ModelLoadingService
|
import com.example.llama.engine.ModelLoadingService
|
||||||
import com.example.llama.revamp.engine.StubInferenceEngine
|
import com.example.llama.engine.StubInferenceEngine
|
||||||
import com.example.llama.revamp.monitoring.PerformanceMonitor
|
import com.example.llama.monitoring.PerformanceMonitor
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
|
|
@ -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
|
||||||
import android.llama.cpp.InferenceEngine.State
|
import android.llama.cpp.InferenceEngine.State
|
||||||
import android.util.Log
|
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.Flow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
@ -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
|
||||||
import android.llama.cpp.InferenceEngine.State
|
import android.llama.cpp.InferenceEngine.State
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.example.llama.revamp.APP_NAME
|
import com.example.llama.APP_NAME
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|
@ -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}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<ActivityManager>()!! }
|
|
||||||
private val downloadManager by lazy { downloadManager ?: getSystemService<DownloadManager>()!! }
|
|
||||||
private val clipboardManager by lazy {
|
|
||||||
clipboardManager ?: getSystemService<ClipboardManager>()!!
|
|
||||||
}
|
|
||||||
|
|
||||||
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<Downloadable>
|
|
||||||
) {
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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!!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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)
|
|
||||||
|
|
@ -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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
)
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.monitoring
|
package com.example.llama.monitoring
|
||||||
|
|
||||||
import android.app.ActivityManager
|
import android.app.ActivityManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.monitoring
|
package com.example.llama.monitoring
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data class containing battery information.
|
* Data class containing battery information.
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.example.llama.revamp.navigation
|
package com.example.llama.navigation
|
||||||
|
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import com.example.llama.revamp.engine.ModelLoadingMetrics
|
import com.example.llama.engine.ModelLoadingMetrics
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigation destinations for the app
|
* Navigation destinations for the app
|
||||||
|
|
@ -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.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
|
@ -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.AnimatedVisibility
|
||||||
import androidx.compose.animation.expandVertically
|
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.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.util.languageCodeToFlagEmoji
|
import com.example.llama.util.languageCodeToFlagEmoji
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
@ -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.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
|
@ -17,7 +17,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
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
|
* Reusable component for handling model unloading dialogs
|
||||||
|
|
@ -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.AnimatedContentTransitionScope
|
||||||
import androidx.compose.animation.core.LinearOutSlowInEasing
|
import androidx.compose.animation.core.LinearOutSlowInEasing
|
||||||
|
|
@ -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.foundation.layout.PaddingValues
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
|
|
@ -7,16 +7,16 @@ import androidx.compose.material3.SnackbarHost
|
||||||
import androidx.compose.material3.SnackbarHostState
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import com.example.llama.revamp.ui.scaffold.bottombar.BenchmarkBottomBar
|
import com.example.llama.ui.scaffold.bottombar.BenchmarkBottomBar
|
||||||
import com.example.llama.revamp.ui.scaffold.bottombar.BottomBarConfig
|
import com.example.llama.ui.scaffold.bottombar.BottomBarConfig
|
||||||
import com.example.llama.revamp.ui.scaffold.bottombar.ConversationBottomBar
|
import com.example.llama.ui.scaffold.bottombar.ConversationBottomBar
|
||||||
import com.example.llama.revamp.ui.scaffold.bottombar.ModelSelectionBottomBar
|
import com.example.llama.ui.scaffold.bottombar.ModelSelectionBottomBar
|
||||||
import com.example.llama.revamp.ui.scaffold.bottombar.ModelsManagementBottomBar
|
import com.example.llama.ui.scaffold.bottombar.ModelsManagementBottomBar
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.DefaultTopBar
|
import com.example.llama.ui.scaffold.topbar.DefaultTopBar
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.NavigationIcon
|
import com.example.llama.ui.scaffold.topbar.NavigationIcon
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.PerformanceTopBar
|
import com.example.llama.ui.scaffold.topbar.PerformanceTopBar
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.StorageTopBar
|
import com.example.llama.ui.scaffold.topbar.StorageTopBar
|
||||||
import com.example.llama.revamp.ui.scaffold.topbar.TopBarConfig
|
import com.example.llama.ui.scaffold.topbar.TopBarConfig
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration of both [TopBarConfig] and [BottomBarConfig]
|
* Configuration of both [TopBarConfig] and [BottomBarConfig]
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.scaffold
|
package com.example.llama.ui.scaffold
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.clickable
|
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.platform.LocalConfiguration
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.APP_NAME
|
import com.example.llama.APP_NAME
|
||||||
import com.example.llama.revamp.navigation.AppDestinations
|
import com.example.llama.navigation.AppDestinations
|
||||||
import com.example.llama.revamp.navigation.NavigationActions
|
import com.example.llama.navigation.NavigationActions
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -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.AnimatedVisibility
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
|
|
@ -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 androidx.compose.foundation.text.input.TextFieldState
|
||||||
import com.example.llama.revamp.data.model.ModelFilter
|
import com.example.llama.data.model.ModelFilter
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.data.model.ModelSortOrder
|
import com.example.llama.data.model.ModelSortOrder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [BottomAppBar] configurations
|
* [BottomAppBar] configurations
|
||||||
|
|
@ -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.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
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.graphics.StrokeCap
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.APP_NAME
|
import com.example.llama.APP_NAME
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ConversationBottomBar(
|
fun ConversationBottomBar(
|
||||||
|
|
@ -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.AnimatedVisibility
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
|
|
@ -30,7 +30,7 @@ import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.data.model.ModelSortOrder
|
import com.example.llama.data.model.ModelSortOrder
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ModelSelectionBottomBar(
|
fun ModelSelectionBottomBar(
|
||||||
|
|
@ -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.padding
|
||||||
import androidx.compose.foundation.layout.size
|
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.res.painterResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.R
|
import com.example.llama.R
|
||||||
import com.example.llama.revamp.data.model.ModelSortOrder
|
import com.example.llama.data.model.ModelSortOrder
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ModelsManagementBottomBar(
|
fun ModelsManagementBottomBar(
|
||||||
|
|
@ -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.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
|
|
@ -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.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
|
@ -21,9 +21,9 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.monitoring.MemoryMetrics
|
import com.example.llama.monitoring.MemoryMetrics
|
||||||
import com.example.llama.revamp.monitoring.TemperatureMetrics
|
import com.example.llama.monitoring.TemperatureMetrics
|
||||||
import com.example.llama.revamp.monitoring.TemperatureWarningLevel
|
import com.example.llama.monitoring.TemperatureWarningLevel
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
|
@ -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.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
|
@ -18,7 +18,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.monitoring.StorageMetrics
|
import com.example.llama.monitoring.StorageMetrics
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
|
@ -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.monitoring.MemoryMetrics
|
||||||
import com.example.llama.revamp.monitoring.StorageMetrics
|
import com.example.llama.monitoring.StorageMetrics
|
||||||
import com.example.llama.revamp.monitoring.TemperatureMetrics
|
import com.example.llama.monitoring.TemperatureMetrics
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [TopAppBar] configurations
|
* [TopAppBar] configurations
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.screens
|
package com.example.llama.ui.screens
|
||||||
|
|
||||||
import android.llama.cpp.InferenceEngine.State
|
import android.llama.cpp.InferenceEngine.State
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
|
|
@ -34,16 +34,16 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.engine.ModelLoadingMetrics
|
import com.example.llama.engine.ModelLoadingMetrics
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentArchitectureRow
|
import com.example.llama.ui.components.ModelCardContentArchitectureRow
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentContextRow
|
import com.example.llama.ui.components.ModelCardContentContextRow
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentField
|
import com.example.llama.ui.components.ModelCardContentField
|
||||||
import com.example.llama.revamp.ui.components.ModelCardCoreExpandable
|
import com.example.llama.ui.components.ModelCardCoreExpandable
|
||||||
import com.example.llama.revamp.ui.components.ModelUnloadDialogHandler
|
import com.example.llama.ui.components.ModelUnloadDialogHandler
|
||||||
import com.example.llama.revamp.ui.theme.MonospacedTextStyle
|
import com.example.llama.ui.theme.MonospacedTextStyle
|
||||||
import com.example.llama.revamp.util.formatMilliSeconds
|
import com.example.llama.util.formatMilliSeconds
|
||||||
import com.example.llama.revamp.viewmodel.BenchmarkViewModel
|
import com.example.llama.viewmodel.BenchmarkViewModel
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BenchmarkScreen(
|
fun BenchmarkScreen(
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.screens
|
package com.example.llama.ui.screens
|
||||||
|
|
||||||
import android.llama.cpp.InferenceEngine.State
|
import android.llama.cpp.InferenceEngine.State
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
|
|
@ -51,16 +51,16 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleEventObserver
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.engine.ModelLoadingMetrics
|
import com.example.llama.engine.ModelLoadingMetrics
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentArchitectureRow
|
import com.example.llama.ui.components.ModelCardContentArchitectureRow
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentContextRow
|
import com.example.llama.ui.components.ModelCardContentContextRow
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentField
|
import com.example.llama.ui.components.ModelCardContentField
|
||||||
import com.example.llama.revamp.ui.components.ModelCardCoreExpandable
|
import com.example.llama.ui.components.ModelCardCoreExpandable
|
||||||
import com.example.llama.revamp.ui.components.ModelUnloadDialogHandler
|
import com.example.llama.ui.components.ModelUnloadDialogHandler
|
||||||
import com.example.llama.revamp.util.formatMilliSeconds
|
import com.example.llama.util.formatMilliSeconds
|
||||||
import com.example.llama.revamp.viewmodel.ConversationViewModel
|
import com.example.llama.viewmodel.ConversationViewModel
|
||||||
import com.example.llama.revamp.viewmodel.Message
|
import com.example.llama.viewmodel.Message
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -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.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
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.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentArchitectureRow
|
import com.example.llama.ui.components.ModelCardContentArchitectureRow
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentContextRow
|
import com.example.llama.ui.components.ModelCardContentContextRow
|
||||||
import com.example.llama.revamp.ui.components.ModelCardContentTitleRow
|
import com.example.llama.ui.components.ModelCardContentTitleRow
|
||||||
import com.example.llama.revamp.util.FileType
|
import com.example.llama.util.FileType
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.screens
|
package com.example.llama.ui.screens
|
||||||
|
|
||||||
import android.llama.cpp.InferenceEngine.State
|
import android.llama.cpp.InferenceEngine.State
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
|
|
@ -48,12 +48,12 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.data.model.SystemPrompt
|
import com.example.llama.data.model.SystemPrompt
|
||||||
import com.example.llama.revamp.engine.ModelLoadingMetrics
|
import com.example.llama.engine.ModelLoadingMetrics
|
||||||
import com.example.llama.revamp.ui.components.ModelCardCoreExpandable
|
import com.example.llama.ui.components.ModelCardCoreExpandable
|
||||||
import com.example.llama.revamp.ui.components.ModelUnloadDialogHandler
|
import com.example.llama.ui.components.ModelUnloadDialogHandler
|
||||||
import com.example.llama.revamp.ui.scaffold.ScaffoldEvent
|
import com.example.llama.ui.scaffold.ScaffoldEvent
|
||||||
import com.example.llama.revamp.viewmodel.ModelLoadingViewModel
|
import com.example.llama.viewmodel.ModelLoadingViewModel
|
||||||
|
|
||||||
|
|
||||||
enum class Mode {
|
enum class Mode {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.screens
|
package com.example.llama.ui.screens
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
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.platform.LocalSoftwareKeyboardController
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.ui.components.InfoAction
|
import com.example.llama.ui.components.InfoAction
|
||||||
import com.example.llama.revamp.ui.components.InfoView
|
import com.example.llama.ui.components.InfoView
|
||||||
import com.example.llama.revamp.ui.components.ModelCardFullExpandable
|
import com.example.llama.ui.components.ModelCardFullExpandable
|
||||||
import com.example.llama.revamp.viewmodel.ModelSelectionViewModel
|
import com.example.llama.viewmodel.ModelSelectionViewModel
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.screens
|
package com.example.llama.ui.screens
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
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.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.ui.components.InfoView
|
import com.example.llama.ui.components.InfoView
|
||||||
import com.example.llama.revamp.ui.components.ModelCardFullExpandable
|
import com.example.llama.ui.components.ModelCardFullExpandable
|
||||||
import com.example.llama.revamp.ui.scaffold.ScaffoldEvent
|
import com.example.llama.ui.scaffold.ScaffoldEvent
|
||||||
import com.example.llama.revamp.util.formatFileByteSize
|
import com.example.llama.util.formatFileByteSize
|
||||||
import com.example.llama.revamp.viewmodel.ModelManagementState
|
import com.example.llama.viewmodel.ModelManagementState
|
||||||
import com.example.llama.revamp.viewmodel.ModelManagementState.Deletion
|
import com.example.llama.viewmodel.ModelManagementState.Deletion
|
||||||
import com.example.llama.revamp.viewmodel.ModelManagementState.Importation
|
import com.example.llama.viewmodel.ModelManagementState.Importation
|
||||||
import com.example.llama.revamp.viewmodel.ModelsManagementViewModel
|
import com.example.llama.viewmodel.ModelsManagementViewModel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screen for managing LLM models (view, download, delete)
|
* Screen for managing LLM models (view, download, delete)
|
||||||
|
|
@ -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.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
|
@ -23,9 +23,9 @@ import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.example.llama.revamp.APP_NAME
|
import com.example.llama.APP_NAME
|
||||||
import com.example.llama.revamp.data.preferences.UserPreferences
|
import com.example.llama.data.preferences.UserPreferences
|
||||||
import com.example.llama.revamp.viewmodel.SettingsViewModel
|
import com.example.llama.viewmodel.SettingsViewModel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screen for general app settings
|
* Screen for general app settings
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.theme
|
package com.example.llama.ui.theme
|
||||||
|
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
@ -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.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Shapes
|
import androidx.compose.material3.Shapes
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.ui.theme
|
package com.example.llama.ui.theme
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
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.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.core.view.WindowCompat
|
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
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
|
|
||||||
// TODO-han.yin: support more / custom color palettes?
|
// TODO-han.yin: support more / custom color palettes?
|
||||||
|
|
@ -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.material3.Typography
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.util
|
package com.example.llama.util
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.util
|
package com.example.llama.util
|
||||||
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.util
|
package com.example.llama.util
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.util
|
package com.example.llama.util
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.llama.revamp.util
|
package com.example.llama.util
|
||||||
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package com.example.llama.revamp.viewmodel
|
package com.example.llama.viewmodel
|
||||||
|
|
||||||
import android.llama.cpp.isUninterruptible
|
import android.llama.cpp.isUninterruptible
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.engine.BenchmarkService
|
import com.example.llama.engine.BenchmarkService
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
@ -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.TextFieldState
|
||||||
import androidx.compose.foundation.text.input.clearText
|
import androidx.compose.foundation.text.input.clearText
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.llama.revamp.engine.ConversationService
|
import com.example.llama.engine.ConversationService
|
||||||
import com.example.llama.revamp.engine.GenerationUpdate
|
import com.example.llama.engine.GenerationUpdate
|
||||||
import com.example.llama.revamp.engine.TokenMetrics
|
import com.example.llama.engine.TokenMetrics
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.example.llama.revamp.viewmodel
|
package com.example.llama.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.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 dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.example.llama.revamp.viewmodel
|
package com.example.llama.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.llama.revamp.data.model.SystemPrompt
|
import com.example.llama.data.model.SystemPrompt
|
||||||
import com.example.llama.revamp.data.repository.ModelRepository
|
import com.example.llama.data.repository.ModelRepository
|
||||||
import com.example.llama.revamp.data.repository.SystemPromptRepository
|
import com.example.llama.data.repository.SystemPromptRepository
|
||||||
import com.example.llama.revamp.engine.ModelLoadingMetrics
|
import com.example.llama.engine.ModelLoadingMetrics
|
||||||
import com.example.llama.revamp.engine.ModelLoadingService
|
import com.example.llama.engine.ModelLoadingService
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
@ -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.TextFieldState
|
||||||
import androidx.compose.foundation.text.input.clearText
|
import androidx.compose.foundation.text.input.clearText
|
||||||
import androidx.compose.runtime.snapshotFlow
|
import androidx.compose.runtime.snapshotFlow
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.llama.revamp.data.model.ModelFilter
|
import com.example.llama.data.model.ModelFilter
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.data.model.ModelSortOrder
|
import com.example.llama.data.model.ModelSortOrder
|
||||||
import com.example.llama.revamp.data.model.filterBy
|
import com.example.llama.data.model.filterBy
|
||||||
import com.example.llama.revamp.data.model.queryBy
|
import com.example.llama.data.model.queryBy
|
||||||
import com.example.llama.revamp.data.model.sortByOrder
|
import com.example.llama.data.model.sortByOrder
|
||||||
import com.example.llama.revamp.data.repository.ModelRepository
|
import com.example.llama.data.repository.ModelRepository
|
||||||
import com.example.llama.revamp.engine.InferenceService
|
import com.example.llama.engine.InferenceService
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.FlowPreview
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
@ -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
|
||||||
import android.llama.cpp.InferenceEngine.State
|
import android.llama.cpp.InferenceEngine.State
|
||||||
|
|
@ -6,7 +6,7 @@ import android.llama.cpp.isModelLoaded
|
||||||
import android.llama.cpp.isUninterruptible
|
import android.llama.cpp.isUninterruptible
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
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.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
package com.example.llama.revamp.viewmodel
|
package com.example.llama.viewmodel
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.llama.revamp.data.model.ModelFilter
|
import com.example.llama.data.model.ModelFilter
|
||||||
import com.example.llama.revamp.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.revamp.data.model.ModelSortOrder
|
import com.example.llama.data.model.ModelSortOrder
|
||||||
import com.example.llama.revamp.data.model.filterBy
|
import com.example.llama.data.model.filterBy
|
||||||
import com.example.llama.revamp.data.model.sortByOrder
|
import com.example.llama.data.model.sortByOrder
|
||||||
import com.example.llama.revamp.data.remote.HuggingFaceModel
|
import com.example.llama.data.remote.HuggingFaceModel
|
||||||
import com.example.llama.revamp.data.repository.InsufficientStorageException
|
import com.example.llama.data.repository.InsufficientStorageException
|
||||||
import com.example.llama.revamp.data.repository.ModelRepository
|
import com.example.llama.data.repository.ModelRepository
|
||||||
import com.example.llama.revamp.util.getFileNameFromUri
|
import com.example.llama.util.getFileNameFromUri
|
||||||
import com.example.llama.revamp.util.getFileSizeFromUri
|
import com.example.llama.util.getFileSizeFromUri
|
||||||
import com.example.llama.revamp.viewmodel.ModelManagementState.Deletion
|
import com.example.llama.viewmodel.ModelManagementState.Deletion
|
||||||
import com.example.llama.revamp.viewmodel.ModelManagementState.Importation
|
import com.example.llama.viewmodel.ModelManagementState.Importation
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package com.example.llama.revamp.viewmodel
|
package com.example.llama.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.llama.revamp.data.preferences.UserPreferences
|
import com.example.llama.data.preferences.UserPreferences
|
||||||
import com.example.llama.revamp.data.repository.ModelRepository
|
import com.example.llama.data.repository.ModelRepository
|
||||||
import com.example.llama.revamp.monitoring.BatteryMetrics
|
import com.example.llama.monitoring.BatteryMetrics
|
||||||
import com.example.llama.revamp.monitoring.MemoryMetrics
|
import com.example.llama.monitoring.MemoryMetrics
|
||||||
import com.example.llama.revamp.monitoring.PerformanceMonitor
|
import com.example.llama.monitoring.PerformanceMonitor
|
||||||
import com.example.llama.revamp.monitoring.StorageMetrics
|
import com.example.llama.monitoring.StorageMetrics
|
||||||
import com.example.llama.revamp.monitoring.TemperatureMetrics
|
import com.example.llama.monitoring.TemperatureMetrics
|
||||||
import com.example.llama.revamp.monitoring.TemperatureWarningLevel
|
import com.example.llama.monitoring.TemperatureWarningLevel
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
Loading…
Reference in New Issue