Skip to content

armgit / andee

Public Imported from GitHub
0

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、支持任意模型,记忆和密码绝不离开设备。

feat: the way out sits under each key row, and the CodeFlying tab says it is empty

booboosui4297426b0b74
diff --git a/app/src/main/java/net/kuafuai/andee/ui/SettingsUi.kt b/app/src/main/java/net/kuafuai/andee/ui/SettingsUi.kt
index 5dd1799..212ca87 100644
--- a/app/src/main/java/net/kuafuai/andee/ui/SettingsUi.kt
+++ b/app/src/main/java/net/kuafuai/andee/ui/SettingsUi.kt
@@ -644,7 +644,18 @@ class SettingsUi(
// CodeFlying: configured says "what this is, you may be billed",
// unconfigured says "it's not set up on this APK, go to the website".
val cfBlock = block(panel)
- val cfNoteKey = if (VoiceConfig.isCodeFlyingAvailable()) {
+ val cfReady = VoiceConfig.isCodeFlyingAvailable()
+ // A person who lands on this tab has already said "I don't have keys".
+ // If this build carries no CodeFlying either, that has to be the first
+ // thing said, not a paragraph they have to infer it from — the note
+ // below explains how to get one, but only this line says the tab in
+ // front of them is currently doing nothing.
+ if (!cfReady) {
+ cfBlock.addView(noteView(lctx.getString(R.string.settings_codeflying_not_connected)).apply {
+ setTextColor(Color.parseColor(Glass.WARN))
+ }, rowParams(dp(4)))
+ }
+ val cfNoteKey = if (cfReady) {
R.string.settings_brain_codeflying_note
} else {
R.string.settings_brain_codeflying_unconfigured
@@ -665,6 +676,14 @@ class SettingsUi(
hint = "sk-…",
secret = true,
)
+ // Directly under the row that asks for it: whoever has no key is
+ // reading this row, not the picker at the top of the card. Tapping
+ // moves the tab under their finger rather than sending them up to
+ // find which cell that was — and it only moves the pick; 保存 still
+ // commits it, like every other row.
+ linkNote(localBlock, lctx.getString(R.string.settings_no_key_use_codeflying)) {
+ pickBrain(VoiceConfig.BRAIN_CODEFLYING)
+ }
field(
localBlock,
"llm_model",
@@ -698,15 +717,6 @@ class SettingsUi(
),
)
note(localBlock, lctx.getString(R.string.settings_brain_local_note))
- // The rows above ask for two keys a person may simply not have, and for
- // them the answer is a different tab — not a third thing to fill in. So
- // it is one tap here, and the tab moves under their finger rather than
- // sending them back up to the picker to find which cell that was.
- //
- // It only moves the pick; 保存 still commits it, like every other row.
- linkNote(localBlock, lctx.getString(R.string.settings_no_key_use_codeflying)) {
- pickBrain(VoiceConfig.BRAIN_CODEFLYING)
- }
// ---- Which service hears and speaks ----
//
@@ -747,6 +757,11 @@ class SettingsUi(
hint = lctx.getString(R.string.settings_voice_api_key_hint),
secret = true,
)
+ // Same line, same reason, under the voice key: this is the other half
+ // of what CodeFlying would hand over for free.
+ linkNote(huoshanBlock, lctx.getString(R.string.settings_no_key_use_codeflying)) {
+ pickBrain(VoiceConfig.BRAIN_CODEFLYING)
+ }
field(huoshanBlock, "asr_endpoint", lctx.getString(R.string.settings_voice_asr_endpoint))
field(huoshanBlock, "asr_resource_id", lctx.getString(R.string.settings_voice_asr_resource_id))
field(huoshanBlock, "tts_endpoint", lctx.getString(R.string.settings_voice_tts_endpoint))
@@ -786,6 +801,9 @@ class SettingsUi(
},
secret = true,
)
+ linkNote(googleBlock, lctx.getString(R.string.settings_no_key_use_codeflying)) {
+ pickBrain(VoiceConfig.BRAIN_CODEFLYING)
+ }
field(
googleBlock,
"google_project",
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index 4c05163..6f6433e 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -94,6 +94,7 @@
<string name="common_medium">Medium</string>
<string name="common_low">Low</string>
<string name="settings_brain_local_note">The device runs the agent loop itself, with no hub. Without a key it will not take over.</string>
+ <string name="settings_codeflying_not_connected">CodeFlying is not connected yet</string>
<string name="settings_no_key_use_codeflying">No key? Tap here to switch to CodeFlying</string>
<string name="settings_section_wake">Wake word</string>
<string name="settings_wake_enrolled">Enrolled — say your wake word and it wakes up</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b923051..f6a6208 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -71,6 +71,7 @@
<string name="common_medium">中</string>
<string name="common_low">低</string>
<string name="settings_brain_local_note">设备自己跑 agent loop,不连 Hub。没有 Key 就不会接管。</string>
+ <string name="settings_codeflying_not_connected">您还未接入 CodeFlying</string>
<string name="settings_no_key_use_codeflying">没有密钥?点这里切换到 CodeFlying 配置</string>
<string name="settings_section_wake">语音唤醒</string>
<string name="settings_wake_enrolled">已录入 —— 说出你录的唤醒词就行</string>
diff --git a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/SettingsScreen.kt b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/SettingsScreen.kt
index ad49a5a..c37a0ab 100644
--- a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/SettingsScreen.kt
+++ b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/SettingsScreen.kt
@@ -89,9 +89,20 @@ fun SettingsScreen(
GlassField(st("settings_device_name"), v["device_name"].orEmpty(), { v["device_name"] = it }, hint = st("settings_device_name_hint"))
Note(st("settings_brain_cloud_note"))
}
- "codeflying" -> Note(st("settings_brain_codeflying_unconfigured"))
+ // macOS has no CodeFlying endpoint in the build — Assistant.config
+ // keeps the mode but still talks to the key from 本机 — so this tab
+ // is never wired up here, and says so before it explains how to.
+ "codeflying" -> {
+ Text(
+ st("settings_codeflying_not_connected"),
+ color = Palette.warn, fontSize = 13.sp,
+ modifier = Modifier.padding(top = 8.dp),
+ )
+ Note(st("settings_brain_codeflying_unconfigured"))
+ }
else -> {
GlassField(st("settings_llm_api_key"), v["llm_api_key"].orEmpty(), { v["llm_api_key"] = it }, secret = true, hint = "sk-…")
+ NoKeyHint { v["brain"] = "codeflying" }
GlassField(st("settings_llm_model"), v["llm_model"].orEmpty(), { v["llm_model"] = it }, hint = llmModelHint)
GlassField(st("settings_llm_base_url"), v["llm_base_url"].orEmpty(), { v["llm_base_url"] = it }, hint = llmUrlHint)
RowLabel(st("settings_llm_thinking"))
@@ -105,16 +116,6 @@ fun SettingsScreen(
) { v["llm_reasoning_effort"] = it }
}
Note(st("settings_brain_local_note"))
- // The rows above ask for two keys a person may simply not have.
- // Switching the tab for them is the whole answer, so it is one tap
- // here rather than a trip back to the picker at the top — and it is
- // written into the form's own map, so 保存 is what commits it, like
- // every other row on this card.
- Text(
- st("settings_no_key_use_codeflying"),
- color = Palette.accent, fontSize = 12.sp,
- modifier = Modifier.padding(top = 8.dp).clickable { v["brain"] = "codeflying" },
- )
}
}
@@ -127,6 +128,7 @@ fun SettingsScreen(
) { v["voice_provider"] = it }
if (provider == "google") {
GlassField(st("settings_google_api_key"), v["google_api_key"].orEmpty(), { v["google_api_key"] = it }, secret = true, hint = st("settings_google_api_key_hint"))
+ NoKeyHint { v["brain"] = "codeflying" }
GlassField(st("settings_google_project"), v["google_project"].orEmpty(), { v["google_project"] = it }, hint = st("settings_google_project_hint"))
GlassField(st("settings_google_location"), v["google_location"].orEmpty(), { v["google_location"] = it }, hint = "asia-northeast1")
GlassField(st("settings_google_asr_model"), v["google_asr_model"].orEmpty(), { v["google_asr_model"] = it }, hint = "gemini-live-2.5-flash-preview-native-audio")
@@ -136,6 +138,7 @@ fun SettingsScreen(
Note(st("settings_voice_google_note"))
} else {
GlassField(st("settings_voice_api_key"), v["api_key"].orEmpty(), { v["api_key"] = it }, secret = true, hint = st("settings_voice_api_key_hint"))
+ NoKeyHint { v["brain"] = "codeflying" }
GlassField(st("settings_voice_asr_endpoint"), v["asr_endpoint"].orEmpty(), { v["asr_endpoint"] = it }, hint = "wss://openspeech.bytedance.com/api/v3/sauc/bigmodel_async")
GlassField(st("settings_voice_asr_resource_id"), v["asr_resource_id"].orEmpty(), { v["asr_resource_id"] = it }, hint = "volc.bigasr.sauc.duration")
GlassField(st("settings_voice_tts_endpoint"), v["tts_endpoint"].orEmpty(), { v["tts_endpoint"] = it }, hint = "wss://openspeech.bytedance.com/api/v3/tts/bidirection")
@@ -297,6 +300,20 @@ private fun RowLabel(text: String) {
Text(text, color = Palette.secondary, fontSize = 12.sp, modifier = Modifier.padding(top = 12.dp, bottom = 4.dp))
}
+/**
+ * The way out of a key row, sitting under that row: whoever has no key is
+ * reading the row, not the picker at the top of the card. One tap, written into
+ * the form's own map — so 保存 is still what commits it, like every row here.
+ */
+@Composable
+private fun NoKeyHint(onPick: () -> Unit) {
+ Text(
+ st("settings_no_key_use_codeflying"),
+ color = Palette.accent, fontSize = 12.sp,
+ modifier = Modifier.padding(top = 6.dp).clickable { onPick() },
+ )
+}
+
@Composable
private fun DangerButton(label: String, onClick: () -> Unit) {
Text(
diff --git a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/UiShot.kt b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/UiShot.kt
index 5aa5e4b..8b7c413 100644
--- a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/UiShot.kt
+++ b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/UiShot.kt
@@ -23,10 +23,13 @@ fun main(args: Array<String>) {
val h = args.getOrElse(2) { "820" }.toInt()
val out = File(args.getOrElse(3) { "/tmp/ui.png" })
System.setProperty("andee.home", File.createTempFile("andee-shot", "").also { it.delete(); it.mkdirs() }.path)
- // Optional: `lang=en` and `theme=day`, set in the throwaway home before anything draws.
+ // Optional: `lang=en`, `theme=day` and `brain=codeflying`, set in the throwaway
+ // home before anything draws — the last one because which backend tab is open
+ // decides what half of the settings card looks like.
for (a in args.drop(5)) a.split('=', limit = 2).takeIf { it.size == 2 }?.let { (k, v) ->
if (k == "lang") Settings.save(mapOf("lang" to v))
if (k == "theme") Palette.setNight(v == "night")
+ if (k == "brain") Settings.save(mapOf("brain" to v))
}
if (args.getOrElse(4) { "" } == "empty") Scrollback.wipe() else seed()
@Suppress("UNUSED_VARIABLE") val unused = 0
diff --git a/desktop/src/main/resources/strings_en.properties b/desktop/src/main/resources/strings_en.properties
index 1959110..160d23c 100644
--- a/desktop/src/main/resources/strings_en.properties
+++ b/desktop/src/main/resources/strings_en.properties
@@ -83,6 +83,7 @@ s_common_medium=Medium
s_common_low=Low
s_settings_brain_local_note=The device runs the agent loop itself, with no hub. Without a key it will not take over.
s_settings_no_key_use_codeflying=No key? Click here to switch to CodeFlying
+s_settings_codeflying_not_connected=CodeFlying is not connected yet
s_settings_section_wake=Wake word
s_settings_wake_enrolled=Enrolled — say your wake word and it wakes up
s_settings_wake_not_enrolled=Not enrolled — pick a phrase and say it 3 times to wake me by voice, e.g. “Hey Andee”
diff --git a/desktop/src/main/resources/strings_zh.properties b/desktop/src/main/resources/strings_zh.properties
index 0908495..b015707 100644
--- a/desktop/src/main/resources/strings_zh.properties
+++ b/desktop/src/main/resources/strings_zh.properties
@@ -83,6 +83,7 @@ s_common_medium=中
s_common_low=低
s_settings_brain_local_note=设备自己跑 agent loop,不连 Hub。没有 Key 就不会接管。
s_settings_no_key_use_codeflying=没有密钥?点这里切换到 CodeFlying 配置
+s_settings_codeflying_not_connected=您还未接入 CodeFlying
s_settings_section_wake=语音唤醒
s_settings_wake_enrolled=已录入 —— 说出你录的唤醒词就行
s_settings_wake_not_enrolled=未录入 —— 自己选个词录 3 遍就能语音唤醒,例如「嘿 Andee」