ServerSetupViewModel

class ServerSetupViewModel(val launchSource: LaunchSource = LaunchSource.SPLASH, val dispatchersProvider: DispatchersProvider, val buildInfoProvider: BuildInfoProvider, val getConfigurationUseCase: GetConfigurationUseCase, val getLocalOnnxModelsUseCase: GetLocalOnnxModelsUseCase, val getLocalMediaPipeModelsUseCase: GetLocalMediaPipeModelsUseCase, val fetchHuggingFaceModelsUseCase: FetchHuggingFaceModelsUseCase, val urlValidator: UrlValidator, val stringValidator: CommonStringValidator, val filePathValidator: FilePathValidator, val connectToA1111UseCase: ConnectToA1111UseCase, val connectToSwarmUiUseCase: ConnectToSwarmUiUseCase, val connectToHordeUseCase: ConnectToHordeUseCase, val connectToHuggingFaceUseCase: ConnectToHuggingFaceUseCase, val connectToLocalDiffusionUseCase: ConnectToLocalDiffusionUseCase, val connectToMediaPipeUseCase: ConnectToMediaPipeUseCase, val connectToOpenAiUseCase: ConnectToOpenAiUseCase, val connectToStabilityAiUseCase: ConnectToStabilityAiUseCase, val downloadModelUseCase: DownloadModelUseCase, val deleteModelUseCase: DeleteModelUseCase, val downloadGuard: ServerSetupDownloadGuard, val linksProvider: LinksProvider, val preferenceManager: PreferenceManager, val router: ServerSetupRouter, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<ServerSetupState, ServerSetupIntent, ServerSetupEffect> (source)

Coordinates ServerSetupViewModel behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(launchSource: LaunchSource = LaunchSource.SPLASH, dispatchersProvider: DispatchersProvider, buildInfoProvider: BuildInfoProvider, getConfigurationUseCase: GetConfigurationUseCase, getLocalOnnxModelsUseCase: GetLocalOnnxModelsUseCase, getLocalMediaPipeModelsUseCase: GetLocalMediaPipeModelsUseCase, fetchHuggingFaceModelsUseCase: FetchHuggingFaceModelsUseCase, urlValidator: UrlValidator, stringValidator: CommonStringValidator, filePathValidator: FilePathValidator, connectToA1111UseCase: ConnectToA1111UseCase, connectToSwarmUiUseCase: ConnectToSwarmUiUseCase, connectToHordeUseCase: ConnectToHordeUseCase, connectToHuggingFaceUseCase: ConnectToHuggingFaceUseCase, connectToLocalDiffusionUseCase: ConnectToLocalDiffusionUseCase, connectToMediaPipeUseCase: ConnectToMediaPipeUseCase, connectToOpenAiUseCase: ConnectToOpenAiUseCase, connectToStabilityAiUseCase: ConnectToStabilityAiUseCase, downloadModelUseCase: DownloadModelUseCase, deleteModelUseCase: DeleteModelUseCase, downloadGuard: ServerSetupDownloadGuard, linksProvider: LinksProvider, preferenceManager: PreferenceManager, router: ServerSetupRouter, onError: (Throwable) -> Unit = {})

Properties

Link copied to clipboard
private val _effect: Channel<E>
Link copied to clipboard
private val _state: MutableStateFlow<S>
Link copied to clipboard

Exposes the buildInfoProvider value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToA1111UseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToHordeUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToHuggingFaceUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToLocalDiffusionUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToMediaPipeUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToOpenAiUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToStabilityAiUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the connectToSwarmUiUseCase value used by the SDAI presentation layer.

Link copied to clipboard
Link copied to clipboard

Exposes the deleteModelUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the dispatchersProvider value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the downloadGuard value used by the SDAI presentation layer.

Link copied to clipboard
private val downloadJobs: MutableMap<String, Job>
Link copied to clipboard

Exposes the downloadModelUseCase value used by the SDAI presentation layer.

Link copied to clipboard
open override val effect: Flow<ServerSetupEffect>
Link copied to clipboard
private val effectDispatcher: CoroutineDispatcher
Link copied to clipboard

Exposes the fetchHuggingFaceModelsUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the filePathValidator value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the getConfigurationUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the getLocalMediaPipeModelsUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the getLocalOnnxModelsUseCase value used by the SDAI presentation layer.

Link copied to clipboard
Link copied to clipboard

Exposes the launchSource value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the linksProvider value used by the SDAI presentation layer.

Link copied to clipboard
private val onError: (Throwable) -> Unit

Exposes the onError value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the preferenceManager value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the router value used by the SDAI presentation layer.

Link copied to clipboard
open override val state: StateFlow<ServerSetupState>
Link copied to clipboard

Exposes the stringValidator value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the urlValidator value used by the SDAI presentation layer.

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
internal expect fun clear()
Link copied to clipboard
private suspend fun connectToAutomaticInstance(): Result<Unit>
Link copied to clipboard
private suspend fun connectToHorde(): Result<Unit>
Link copied to clipboard
private suspend fun connectToHuggingFace(): Result<Unit>
Link copied to clipboard
private suspend fun connectToLocalDiffusion(): Result<Unit>
Link copied to clipboard
private suspend fun connectToMediaPipe(): Result<Unit>
Link copied to clipboard
private suspend fun connectToOpenAi(): Result<Unit>
Link copied to clipboard
private fun connectToServer()
Link copied to clipboard
private suspend fun connectToStabilityAi(): Result<Unit>
Link copied to clipboard
private suspend fun connectToSwarmUi(): Result<Unit>
Link copied to clipboard
private fun deleteLocalModel(id: String)
Link copied to clipboard
private fun download(modelId: String, url: String)
Link copied to clipboard
protected fun emitEffect(effect: ServerSetupEffect)
Link copied to clipboard
protected fun emitState(state: ServerSetupState)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
protected fun launch(dispatcher: CoroutineDispatcher, start: CoroutineStart, block: suspend CoroutineScope.() -> Unit): Job
Link copied to clipboard
protected expect open fun onCleared()
Link copied to clipboard
Link copied to clipboard
open override fun processIntent(intent: ServerSetupIntent)
Link copied to clipboard
private fun scopeLaunchDownload(localModel: ServerSetupState.LocalModel, url: String): Job
Link copied to clipboard
protected fun updateState(mutation: (ServerSetupState) -> ServerSetupState)
Link copied to clipboard
private fun validate(): Boolean
Link copied to clipboard