EngineSelectionViewModel

class EngineSelectionViewModel(val dispatchersProvider: DispatchersProvider, val fetchAndGetSwarmUiModelsUseCase: FetchAndGetSwarmUiModelsUseCase, val observeLocalOnnxModelsUseCase: ObserveLocalOnnxModelsUseCase, val fetchAndGetStabilityAiEnginesUseCase: FetchAndGetStabilityAiEnginesUseCase, val getHuggingFaceModelsUseCase: FetchHuggingFaceModelsUseCase, val preferenceManager: PreferenceManager, val getConfigurationUseCase: GetConfigurationUseCase, val selectStableDiffusionModelUseCase: SelectStableDiffusionModelUseCase, val getStableDiffusionModelsUseCase: GetStableDiffusionModelsUseCase, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<EngineSelectionState, EngineSelectionIntent, EmptyEffect> (source)

Coordinates EngineSelectionViewModel behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(dispatchersProvider: DispatchersProvider, fetchAndGetSwarmUiModelsUseCase: FetchAndGetSwarmUiModelsUseCase, observeLocalOnnxModelsUseCase: ObserveLocalOnnxModelsUseCase, fetchAndGetStabilityAiEnginesUseCase: FetchAndGetStabilityAiEnginesUseCase, getHuggingFaceModelsUseCase: FetchHuggingFaceModelsUseCase, preferenceManager: PreferenceManager, getConfigurationUseCase: GetConfigurationUseCase, selectStableDiffusionModelUseCase: SelectStableDiffusionModelUseCase, getStableDiffusionModelsUseCase: GetStableDiffusionModelsUseCase, 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
Link copied to clipboard

Exposes the dispatchersProvider value used by the SDAI presentation layer.

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

Exposes the fetchAndGetStabilityAiEnginesUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the fetchAndGetSwarmUiModelsUseCase 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 getHuggingFaceModelsUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the getStableDiffusionModelsUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the observeLocalOnnxModelsUseCase 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 selectStableDiffusionModelUseCase value used by the SDAI presentation layer.

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

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
protected fun emitEffect(effect: EmptyEffect)
Link copied to clipboard
protected fun emitState(state: EngineSelectionState)
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
private suspend fun <T> loadList(block: suspend () -> List<T>): List<T>
Link copied to clipboard
private suspend fun loadOptions(config: Configuration): RemoteOptions
Link copied to clipboard
protected expect open fun onCleared()
Link copied to clipboard
open override fun processIntent(intent: EngineSelectionIntent)
Link copied to clipboard
private fun selectA1111Model(value: String)
Link copied to clipboard