diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/main/MainViewModel.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/main/MainViewModel.kt index da625f58..0a80a755 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/main/MainViewModel.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/main/MainViewModel.kt @@ -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 { diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setup/SetupViewModel.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setup/SetupViewModel.kt index 54207df3..275dedd4 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setup/SetupViewModel.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setup/SetupViewModel.kt @@ -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, @@ -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)