Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MainViewModel @Inject constructor(private val settingRepository: SettingRe
viewModelScope.launch {
val platforms = settingRepository.fetchPlatforms()

if (platforms.all { it.token == null || it.model == null }) {
if (platforms.all { it.enabled.not() }) {
// Initialize
sendSplashEvent(SplashEvent.OpenIntro)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SetupViewModel @Inject constructor(private val settingRepository: SettingR
Route.OLLAMA_API_ADDRESS,
Route.SETUP_COMPLETE
)
val commonSteps = setOf(Route.SELECT_PLATFORM, Route.TOKEN_INPUT, Route.SETUP_COMPLETE)
val commonSteps = mutableSetOf(Route.SELECT_PLATFORM, Route.TOKEN_INPUT, Route.SETUP_COMPLETE)
val platformStep = mapOf(
Route.OPENAI_MODEL_SELECT to ApiType.OPENAI,
Route.ANTHROPIC_MODEL_SELECT to ApiType.ANTHROPIC,
Expand All @@ -129,6 +129,12 @@ class SetupViewModel @Inject constructor(private val settingRepository: SettingR

val currentIndex = steps.indexOfFirst { it == currentRoute }
val enabledPlatform = platformState.value.filter { it.selected }.map { it.name }.toSet()

if (enabledPlatform.size == 1 && ApiType.OLLAMA in enabledPlatform) {
// Skip API Token input page
commonSteps.remove(Route.TOKEN_INPUT)
}

val remainingSteps = steps.filterIndexed { index, setupStep ->
index > currentIndex &&
(setupStep in commonSteps || platformStep[setupStep] in enabledPlatform)
Expand Down