Skip to content

Commit 0abb6d0

Browse files
authored
Merge pull request #82 from Taewan-P/fix/setting-not-saved
Fix going to intro screen when Ollama is only initially selected and used
2 parents 437f033 + ff590a6 commit 0abb6d0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/main/MainViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MainViewModel @Inject constructor(private val settingRepository: SettingRe
3232
viewModelScope.launch {
3333
val platforms = settingRepository.fetchPlatforms()
3434

35-
if (platforms.all { it.token == null || it.model == null }) {
35+
if (platforms.all { it.enabled.not() }) {
3636
// Initialize
3737
sendSplashEvent(SplashEvent.OpenIntro)
3838
} else {

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setup/SetupViewModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class SetupViewModel @Inject constructor(private val settingRepository: SettingR
118118
Route.OLLAMA_API_ADDRESS,
119119
Route.SETUP_COMPLETE
120120
)
121-
val commonSteps = setOf(Route.SELECT_PLATFORM, Route.TOKEN_INPUT, Route.SETUP_COMPLETE)
121+
val commonSteps = mutableSetOf(Route.SELECT_PLATFORM, Route.TOKEN_INPUT, Route.SETUP_COMPLETE)
122122
val platformStep = mapOf(
123123
Route.OPENAI_MODEL_SELECT to ApiType.OPENAI,
124124
Route.ANTHROPIC_MODEL_SELECT to ApiType.ANTHROPIC,
@@ -129,6 +129,12 @@ class SetupViewModel @Inject constructor(private val settingRepository: SettingR
129129

130130
val currentIndex = steps.indexOfFirst { it == currentRoute }
131131
val enabledPlatform = platformState.value.filter { it.selected }.map { it.name }.toSet()
132+
133+
if (enabledPlatform.size == 1 && ApiType.OLLAMA in enabledPlatform) {
134+
// Skip API Token input page
135+
commonSteps.remove(Route.TOKEN_INPUT)
136+
}
137+
132138
val remainingSteps = steps.filterIndexed { index, setupStep ->
133139
index > currentIndex &&
134140
(setupStep in commonSteps || platformStep[setupStep] in enabledPlatform)

0 commit comments

Comments
 (0)