Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。
fix(config): let local.properties ASR/TTS endpoints override prefs
booboosuid9c11bd160fb
diff --git a/app/src/main/java/net/kuafuai/andee/config/VoiceConfig.kt b/app/src/main/java/net/kuafuai/andee/config/VoiceConfig.ktindex b7736d2..645dd3e 100644--- a/app/src/main/java/net/kuafuai/andee/config/VoiceConfig.kt+++ b/app/src/main/java/net/kuafuai/andee/config/VoiceConfig.kt@@ -54,7 +54,7 @@ data class VoiceConfig(* Keys whose blank value means "go back to the compiled default"* rather than "the user didn't touch this row". See [save].*/- private val OVERRIDE_KEYS = setOf("api_key")+ private val OVERRIDE_KEYS = setOf("api_key", "asr_endpoint", "tts_endpoint")const val DEFAULT_ASR_ENDPOINT = "wss://openspeech.bytedance.com/api/v3/sauc/bigmodel_async"const val DEFAULT_ASR_RESOURCE = "volc.bigasr.sauc.duration"@@ -247,10 +247,21 @@ data class VoiceConfig(// public source. Trim before the fallback so a field cleared to// spaces behaves like a cleared field.apiKey = p.getString("api_key", "").orEmpty().trim().ifEmpty { BuildConfig.API_KEY },- asrEndpoint = p.getString("asr_endpoint", BuildConfig.ASR_ENDPOINT)!!,+ // asr/tts endpoints: prefs (if set) > BuildConfig (if non-empty)+ // > official address. The BuildConfig step is how local.properties+ // can override the default, and it sits ABOVE the official fallback+ // so a custom endpoint survives even when the user clears the+ // settings field (which removes the pref).+ asrEndpoint = p.getString("asr_endpoint", null)+ ?.takeIf { it.isNotEmpty() }+ ?: BuildConfig.ASR_ENDPOINT.takeIf { it.isNotEmpty() }+ ?: DEFAULT_ASR_ENDPOINT,asrResourceId = p.getString("asr_resource_id", DEFAULT_ASR_RESOURCE)!!,asrUid = uid,- ttsEndpoint = p.getString("tts_endpoint", BuildConfig.TTS_ENDPOINT)!!,+ ttsEndpoint = p.getString("tts_endpoint", null)+ ?.takeIf { it.isNotEmpty() }+ ?: BuildConfig.TTS_ENDPOINT.takeIf { it.isNotEmpty() }+ ?: DEFAULT_TTS_ENDPOINT,ttsResourceId = p.getString("tts_resource_id", DEFAULT_TTS_RESOURCE)!!,// The voice follows the ball's look; [TTS_SPEAKER] is the// fallback for looks that don't name one.@@ -292,11 +303,14 @@ data class VoiceConfig(// The overridable credential shows what is *saved*, not what is// in effect: an empty box is how the screen says "the factory// value is in use", and it is the state that [save] returns to.+ // asr_endpoint/tts_endpoint joined api_key here: they are also+ // overridable from local.properties now, so the settings card+ // must show saved-or-empty rather than saved-or-default."api_key" to p.getString("api_key", "").orEmpty(),- "asr_endpoint" to p.getString("asr_endpoint", DEFAULT_ASR_ENDPOINT)!!,+ "asr_endpoint" to p.getString("asr_endpoint", "").orEmpty(),"asr_resource_id" to p.getString("asr_resource_id", DEFAULT_ASR_RESOURCE)!!,"uid" to p.getString("uid", "").orEmpty(),- "tts_endpoint" to p.getString("tts_endpoint", DEFAULT_TTS_ENDPOINT)!!,+ "tts_endpoint" to p.getString("tts_endpoint", "").orEmpty(),"tts_resource_id" to p.getString("tts_resource_id", DEFAULT_TTS_RESOURCE)!!,"tts_sample_rate" to p.getInt("tts_sample_rate", DEFAULT_TTS_SAMPLE_RATE).toString(),"hub_url" to hc.url,