Settings: the assistant's model, and it holds for every new chat
CI / check (push) Canceled after 0s

Settings › Assistant › Assistant model: "Instance default" or one of the
instance's models, saved as the existing assistantModel preference.

The controller keeps the model for new chats apart from the model of the
chat the sheet is in: New chat after "Continue the last chat" goes back to
it, a change in Settings reaches a sheet that is still alive, and a question
asked before the model list was read waits for it (and falls back to the
saved choice, not to the instance's default, when the list cannot be read).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.2 committed 2026-11-13 14:17:27 +00:00
1 parent 2f43b94e56
commit 7ca44ef5e2
17 files changed
+212 -6

No files matched your search

@@ -1,6 +1,7 @@
package eu.llembas.android
import eu.llembas.android.api.LiveReply
import eu.llembas.android.api.ModelInfo
import eu.llembas.android.api.Step
import eu.llembas.android.api.Tail
import eu.llembas.android.assist.AssistController
@@ -53,6 +54,22 @@ class AssistTest {
assertEquals("Because.", earlier.steps.single().markdown)
}
@Test
fun theAssistantsModelIsTheOneChosenInSettings() {
val models = listOf(ModelInfo("large"), ModelInfo("standard", default = true), ModelInfo("quick"))
// The choice, whatever the account's and the instance's defaults are.
assertEquals("quick", AssistController.assistantModelFor("quick", "large", models))
// "Instance default": the account's default, as a new chat in the app starts.
assertEquals("large", AssistController.assistantModelFor("", "large", models))
// No account default (or one that is gone): the instance's, then its first.
assertEquals("standard", AssistController.assistantModelFor("", null, models))
assertEquals("standard", AssistController.assistantModelFor("", "retired", models))
assertEquals("large", AssistController.assistantModelFor("", null, models.map { it.copy(default = false) }))
// A chosen model the instance no longer has falls back the same way, and none is none.
assertEquals("large", AssistController.assistantModelFor("retired", "large", models))
assertEquals(null, AssistController.assistantModelFor("quick", null, emptyList()))
}
@Test
fun aVoiceReadsOnlyTheWords() {
val steps = listOf(
@@ -375,6 +375,7 @@ object Fakes {
wakeState = WakeState.Listening("OK Google"),
notificationsBuild = true,
navApps = listOf("google", "osmand"),
assistantModels = models,
)
/** The wake word in trouble, and its test having heard the phrase: what the rows say then. */
@@ -63,6 +63,7 @@ import eu.llembas.android.ui.scheduled.ScheduleContent
import eu.llembas.android.ui.scheduled.ScheduleEditContent
import eu.llembas.android.ui.scheduled.ScheduledContent
import eu.llembas.android.ui.scheduled.SchedulingModelsContent
import eu.llembas.android.ui.settings.AssistantModelChoices
import eu.llembas.android.ui.settings.LanguageChoices
import eu.llembas.android.ui.settings.NotificationSummaryGroup
import eu.llembas.android.ui.settings.SettingsActions
@@ -233,6 +234,14 @@ class ScreenShots {
shoot("08-wake-sensitivity", Phone.Small, fontScale = 1.5f) { SheetOver { WakeChoices(WakeChoice.Sensitivity, Fakes.settings.prefs, onPick = {}) } }
}
@Test
fun assistantModel() {
// "Instance default" chosen, then one of the instance's models.
shoot("08-assistant-model", Phone.Scroll) { SheetOver { AssistantModelChoices(Fakes.settings, onPick = {}) } }
val picked = Fakes.settings.copy(prefs = Fakes.settings.prefs.copy(assistantModel = Fakes.models.last().id))
shoot("08-assistant-model-chosen", Phone.Small, fontScale = 1.5f) { SheetOver { AssistantModelChoices(picked, onPick = {}) } }
}
@Test
fun language() {
shoot("17-language", Phone.Scroll) { SheetOver { LanguageChoices(Fakes.settings.prefs, onPick = {}) } }