TextToImageViewModel

class TextToImageViewModel(val dispatchersProvider: DispatchersProvider, val getConfigurationUseCase: GetConfigurationUseCase, val getStableDiffusionSamplersUseCase: GetStableDiffusionSamplersUseCase, val textToImageUseCase: TextToImageUseCase, val saveGenerationResultUseCase: SaveGenerationResultUseCase, val saveLastResultToCacheUseCase: SaveLastResultToCacheUseCase, val interruptGenerationUseCase: InterruptGenerationUseCase, val observeHordeProcessStatusUseCase: ObserveHordeProcessStatusUseCase, val observeLocalDiffusionProcessStatusUseCase: ObserveLocalDiffusionProcessStatusUseCase, val preferenceManager: PreferenceManager, val backgroundTaskManager: BackgroundTaskManager, val backgroundWorkObserver: BackgroundWorkObserver, val platformServices: GenerationPlatformServices, val buildInfoProvider: BuildInfoProvider, val generationFormUpdateEvent: GenerationFormUpdateEvent, val dimensionValidator: DimensionValidator, val imageSaver: ImageSaver, val imageSharer: ImageSharer, val router: TextToImageRouter, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<TextToImageState, TextToImageIntent, EmptyEffect> (source)

Coordinates TextToImageViewModel behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(dispatchersProvider: DispatchersProvider, getConfigurationUseCase: GetConfigurationUseCase, getStableDiffusionSamplersUseCase: GetStableDiffusionSamplersUseCase, textToImageUseCase: TextToImageUseCase, saveGenerationResultUseCase: SaveGenerationResultUseCase, saveLastResultToCacheUseCase: SaveLastResultToCacheUseCase, interruptGenerationUseCase: InterruptGenerationUseCase, observeHordeProcessStatusUseCase: ObserveHordeProcessStatusUseCase, observeLocalDiffusionProcessStatusUseCase: ObserveLocalDiffusionProcessStatusUseCase, preferenceManager: PreferenceManager, backgroundTaskManager: BackgroundTaskManager, backgroundWorkObserver: BackgroundWorkObserver, platformServices: GenerationPlatformServices, buildInfoProvider: BuildInfoProvider, generationFormUpdateEvent: GenerationFormUpdateEvent, dimensionValidator: DimensionValidator, imageSaver: ImageSaver, imageSharer: ImageSharer, router: TextToImageRouter, 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 backgroundTaskManager value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the backgroundWorkObserver value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the buildInfoProvider value used by the SDAI presentation layer.

Link copied to clipboard
Link copied to clipboard

Exposes the dimensionValidator 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
open override val effect: Flow<EmptyEffect>
Link copied to clipboard
private val effectDispatcher: CoroutineDispatcher
Link copied to clipboard

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

Link copied to clipboard
private val imageSaver: ImageSaver

Exposes the imageSaver value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the imageSharer value used by the SDAI presentation layer.

Link copied to clipboard
Link copied to clipboard

Exposes the interruptGenerationUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the observeHordeProcessStatusUseCase value used by the SDAI presentation layer.

Exposes the observeLocalDiffusionProcessStatusUseCase 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 platformServices 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

Exposes the saveGenerationResultUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the saveLastResultToCacheUseCase value used by the SDAI presentation layer.

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

Exposes the textToImageUseCase 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
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: TextToImageState)
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 fun loadConfiguration()
Link copied to clipboard
private fun loadSamplers()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private fun observeSettings()
Link copied to clipboard
protected expect open fun onCleared()
Link copied to clipboard
open override fun processIntent(intent: TextToImageIntent)
Link copied to clipboard
protected fun updateState(mutation: (TextToImageState) -> TextToImageState)