The server added the `me.json` fixture (c51722b), built by the route's own serialiser. The app's language and the assistant's speech services now read through `Me`'s named facts -- `accountLanguage` (null when unsaid, so a kept answer stands), `speechToText` (null when unsaid: the assistant then still tries the instance), `hasSpeechToText`, `hasTextToSpeech` -- and ContractTest holds them to the fixture. Strings regenerated at the same ref: the subagent states and the tree's context line are in the server's catalogues now (sk 355/358). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
14 files changed
+114
-8
No files matched your search
@@ -169,7 +169,7 @@ class MainActivity : ComponentActivity() {
|
||||
// otherwise. Read once per instance in use; kept, so the next start has it at once.
|
||||
LaunchedEffect(instance.id) {
|
||||
runCatching { lembas.instances.clientFor(instance).me() }.onSuccess { me ->
|
||||
if (me.language.isNotBlank()) lembas.instances.savePrefs { it.copy(accountLanguage = me.language) }
|
||||
me.accountLanguage?.let { language -> lembas.instances.savePrefs { it.copy(accountLanguage = language) } }
|
||||
}
|
||||
}
|
||||
// The list is read again each time the drawer opens, so a new title or a finished
|
||||
|
||||
@@ -72,7 +72,24 @@ data class Me(
|
||||
@SerialName("default_model") val defaultModel: String? = null,
|
||||
val permissions: Map<String, Boolean> = emptyMap(),
|
||||
val services: Map<String, Boolean> = emptyMap(),
|
||||
)
|
||||
) {
|
||||
/**
|
||||
* The language the app follows by default (`i18n.for_user`: the account's choice, else the
|
||||
* instance's); null when the server said none, so a kept earlier answer stands.
|
||||
*/
|
||||
val accountLanguage: String? get() = language.ifBlank { null }
|
||||
|
||||
/**
|
||||
* The instance's speech-to-text, through the server (the assistant's LLeMbas voice input):
|
||||
* true or false as the server said it, null when it did not say.
|
||||
*/
|
||||
val speechToText: Boolean? get() = services["stt"]
|
||||
|
||||
val hasSpeechToText: Boolean get() = speechToText == true
|
||||
|
||||
/** The instance's text-to-speech (the assistant's voice reply, Read aloud). */
|
||||
val hasTextToSpeech: Boolean get() = services["tts"] == true
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ModelInfo(
|
||||
|
||||
@@ -147,7 +147,7 @@ class AssistController(private val context: Context, private val scope: Coroutin
|
||||
try {
|
||||
val me = api.me()
|
||||
val models = api.models()
|
||||
stt = me.services["stt"]
|
||||
stt = me.speechToText
|
||||
val chosen = prefs.assistantModel.takeIf { id -> models.any { it.id == id } }
|
||||
?: me.defaultModel?.takeIf { id -> models.any { it.id == id } }
|
||||
?: models.firstOrNull { it.default }?.id
|
||||
@@ -157,8 +157,8 @@ class AssistController(private val context: Context, private val scope: Coroutin
|
||||
connection = Connection.Online,
|
||||
models = models,
|
||||
modelId = it.modelId ?: chosen,
|
||||
canSpeak = me.services["tts"] == true,
|
||||
canListen = me.services["stt"] == true || PhoneRecognizer.available(context),
|
||||
canSpeak = me.hasTextToSpeech,
|
||||
canListen = me.hasSpeechToText || PhoneRecognizer.available(context),
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">limit kroků</string>
|
||||
<string name="progress_stopped_budget">rozpočet</string>
|
||||
<string name="tree_state_working">pracuje</string>
|
||||
<string name="tree_state_waiting">čeká na volný slot</string>
|
||||
<string name="tree_state_finished">dokončený</string>
|
||||
<string name="tree_state_idle">nečinný</string>
|
||||
<string name="tree_state_paused">pozastavený: plný kontext</string>
|
||||
<string name="tree_state_done">hotovo</string>
|
||||
<string name="tree_state_out_of_context">bez kontextu</string>
|
||||
<string name="tree_state_stopped">zastaveno</string>
|
||||
<string name="card_asker">%1$s se ptá:</string>
|
||||
<string name="card_subagent_asks">Podagent %1$s (%2$s), %3$s, se ptá:</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">Schrittlimit</string>
|
||||
<string name="progress_stopped_budget">Budget</string>
|
||||
<string name="tree_state_working">arbeitet</string>
|
||||
<string name="tree_state_waiting">wartet auf einen Platz</string>
|
||||
<string name="tree_state_finished">fertig</string>
|
||||
<string name="tree_state_idle">untätig</string>
|
||||
<string name="tree_state_paused">pausiert: Kontext voll</string>
|
||||
<string name="tree_state_done">fertig</string>
|
||||
<string name="tree_state_out_of_context">Kontext erschöpft</string>
|
||||
<string name="tree_state_stopped">angehalten</string>
|
||||
<string name="card_asker">%1$s fragt:</string>
|
||||
<string name="card_subagent_asks">Subagent %1$s (%2$s), %3$s, fragt:</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">límite de pasos</string>
|
||||
<string name="progress_stopped_budget">presupuesto</string>
|
||||
<string name="tree_state_working">trabajando</string>
|
||||
<string name="tree_state_waiting">esperando una plaza</string>
|
||||
<string name="tree_state_finished">terminado</string>
|
||||
<string name="tree_state_idle">inactivo</string>
|
||||
<string name="tree_state_paused">en pausa: contexto lleno</string>
|
||||
<string name="tree_state_done">terminado</string>
|
||||
<string name="tree_state_out_of_context">sin contexto</string>
|
||||
<string name="tree_state_stopped">detenido</string>
|
||||
<string name="card_asker">%1$s pregunta:</string>
|
||||
<string name="card_subagent_asks">El subagente %1$s (%2$s), %3$s, pregunta:</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">limite d’étapes</string>
|
||||
<string name="progress_stopped_budget">budget</string>
|
||||
<string name="tree_state_working">au travail</string>
|
||||
<string name="tree_state_waiting">attend une place</string>
|
||||
<string name="tree_state_finished">terminé</string>
|
||||
<string name="tree_state_idle">inactif</string>
|
||||
<string name="tree_state_paused">en pause : contexte plein</string>
|
||||
<string name="tree_state_done">terminé</string>
|
||||
<string name="tree_state_out_of_context">contexte épuisé</string>
|
||||
<string name="tree_state_stopped">arrêté</string>
|
||||
<string name="card_asker">%1$s demande :</string>
|
||||
<string name="card_subagent_asks">Le sous-agent %1$s (%2$s), %3$s, demande :</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">lépéskorlát</string>
|
||||
<string name="progress_stopped_budget">keret</string>
|
||||
<string name="tree_state_working">dolgozik</string>
|
||||
<string name="tree_state_waiting">szabad helyre vár</string>
|
||||
<string name="tree_state_finished">kész</string>
|
||||
<string name="tree_state_idle">tétlen</string>
|
||||
<string name="tree_state_paused">szüneteltetve: tele a kontextus</string>
|
||||
<string name="tree_state_done">kész</string>
|
||||
<string name="tree_state_out_of_context">elfogyott a kontextus</string>
|
||||
<string name="tree_state_stopped">leállítva</string>
|
||||
<string name="card_asker">%1$s kérdezi:</string>
|
||||
<string name="card_subagent_asks">A(z) %1$s alügynök (%2$s), %3$s, kérdezi:</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">limite di passi</string>
|
||||
<string name="progress_stopped_budget">budget</string>
|
||||
<string name="tree_state_working">al lavoro</string>
|
||||
<string name="tree_state_waiting">in attesa di un posto</string>
|
||||
<string name="tree_state_finished">finito</string>
|
||||
<string name="tree_state_idle">inattivo</string>
|
||||
<string name="tree_state_paused">in pausa: contesto pieno</string>
|
||||
<string name="tree_state_done">finito</string>
|
||||
<string name="tree_state_out_of_context">senza contesto</string>
|
||||
<string name="tree_state_stopped">interrotto</string>
|
||||
<string name="card_asker">%1$s chiede:</string>
|
||||
<string name="card_subagent_asks">Il subagente %1$s (%2$s), %3$s, chiede:</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">limit kroków</string>
|
||||
<string name="progress_stopped_budget">budżet</string>
|
||||
<string name="tree_state_working">pracuje</string>
|
||||
<string name="tree_state_waiting">czeka na wolne miejsce</string>
|
||||
<string name="tree_state_finished">zakończony</string>
|
||||
<string name="tree_state_idle">bezczynny</string>
|
||||
<string name="tree_state_paused">wstrzymany: pełny kontekst</string>
|
||||
<string name="tree_state_done">gotowe</string>
|
||||
<string name="tree_state_out_of_context">bez kontekstu</string>
|
||||
<string name="tree_state_stopped">zatrzymane</string>
|
||||
<string name="card_asker">%1$s pyta:</string>
|
||||
<string name="card_subagent_asks">Podagent %1$s (%2$s), %3$s, pyta:</string>
|
||||
|
||||
@@ -251,7 +251,12 @@
|
||||
<string name="progress_stopped_steps">limit krokov</string>
|
||||
<string name="progress_stopped_budget">rozpočet</string>
|
||||
<string name="tree_state_working">pracuje</string>
|
||||
<string name="tree_state_waiting">čaká na voľný slot</string>
|
||||
<string name="tree_state_finished">dokončený</string>
|
||||
<string name="tree_state_idle">nečinný</string>
|
||||
<string name="tree_state_paused">pozastavený: plný kontext</string>
|
||||
<string name="tree_state_done">hotovo</string>
|
||||
<string name="tree_state_out_of_context">bez kontextu</string>
|
||||
<string name="tree_state_stopped">zastavené</string>
|
||||
<string name="card_asker">%1$s sa pýta:</string>
|
||||
<string name="card_subagent_asks">Podagent %1$s (%2$s), %3$s, sa pýta:</string>
|
||||
|
||||
@@ -11,6 +11,7 @@ import eu.llembas.android.api.FileListing
|
||||
import eu.llembas.android.api.JobsFrame
|
||||
import eu.llembas.android.api.LembasJson
|
||||
import eu.llembas.android.api.LiveReply
|
||||
import eu.llembas.android.api.Me
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.Metrics
|
||||
import eu.llembas.android.api.Plan
|
||||
@@ -211,6 +212,24 @@ class ContractTest {
|
||||
assertTrue(read.turns[1].running)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun meSaysTheLanguageAndTheServices() {
|
||||
// `/api/v2/me` (me.json): the account's language the app follows by default, and the
|
||||
// instance's speech services the assistant uses.
|
||||
val me = read("me", Me.serializer())
|
||||
assertEquals("sk", me.accountLanguage)
|
||||
assertEquals("qwen", me.defaultModel)
|
||||
assertTrue(me.hasSpeechToText)
|
||||
assertEquals(true, me.speechToText)
|
||||
assertFalse(me.hasTextToSpeech)
|
||||
assertEquals("Frodo", me.account.name)
|
||||
// Not said: no language (a kept answer stands), and speech-to-text unknown, not "no".
|
||||
val silent = me.copy(language = "", services = emptyMap())
|
||||
assertNull(silent.accountLanguage)
|
||||
assertNull(silent.speechToText)
|
||||
assertFalse(silent.hasSpeechToText)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun everyFrameParses() {
|
||||
assertTrue(read("event_steps", StepsFrame.serializer()).steps.isNotEmpty())
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ref": "8dd32015ef4e62a2721db325f5bf665f32bb6b30",
|
||||
"commit": "8dd32015ef4e62a2721db325f5bf665f32bb6b30",
|
||||
"sha256": "1ce08462fc195ce942a5e76b06eaf7bbf5298502ef32ae4f0a060b1ebb98f6de"
|
||||
"ref": "4a98af3165e0e3b009766ea8684081d36a0a3d34",
|
||||
"commit": "4a98af3165e0e3b009766ea8684081d36a0a3d34",
|
||||
"sha256": "c804a30f148911d192854e6fa4fd33bd33b03ad5b956858467e9904a04c1ad71"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"api": 2,
|
||||
"version": "2.0.0",
|
||||
"account": {
|
||||
"id": "user1",
|
||||
"name": "Frodo",
|
||||
"email": "frodo@shire.test"
|
||||
},
|
||||
"language": "sk",
|
||||
"theme": "shire",
|
||||
"default_model": "qwen",
|
||||
"permissions": {
|
||||
"chat.create": true,
|
||||
"chat.delete": false,
|
||||
"chat.model_select": true,
|
||||
"chat.system_prompt": true,
|
||||
"chat.params": true,
|
||||
"files.upload": true,
|
||||
"tools.agent": true,
|
||||
"audio.transcribe": true,
|
||||
"audio.listen": true
|
||||
},
|
||||
"services": {
|
||||
"stt": true,
|
||||
"tts": false,
|
||||
"search": true,
|
||||
"fetch": true,
|
||||
"images": false
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user