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(asr): recognize voice exit commands

李融480d3273eaa5
diff --git a/app/src/main/java/net/kuafuai/andee/asr/VoiceExitCommand.kt b/app/src/main/java/net/kuafuai/andee/asr/VoiceExitCommand.kt
new file mode 100644
index 0000000..8c2e115
--- /dev/null
+++ b/app/src/main/java/net/kuafuai/andee/asr/VoiceExitCommand.kt
@@ -0,0 +1,25 @@
+package net.kuafuai.andee.asr
+
+import java.util.Locale
+
+/**
+ * A small, device-side escape hatch. Match the whole utterance: asking how to
+ * exit, cancelling a subscription, or quoting a command must remain a turn for
+ * the brain rather than unexpectedly shutting the assistant down.
+ */
+internal object VoiceExitCommand {
+ private fun normalize(text: String): String =
+ text.lowercase(Locale.ROOT).filter { it.isLetterOrDigit() }
+
+ private val commands = setOf(
+ "exit Andee", "close Andee", "quit Andee",
+ "Andee exit", "Andee close", "Andee quit",
+ "take a break", "Andee take a break", "Hey Andee take a break",
+ "退出 Andee", "关闭 Andee", "Andee 退出", "Andee 关闭",
+ "退出安迪", "关闭安迪", "安迪退出", "安迪关闭",
+ "休息一下", "先休息一下", "你先休息一下",
+ "Andee 休息一下", "安迪休息一下", "安迪你先休息一下",
+ ).map(::normalize).toSet()
+
+ fun matches(text: String): Boolean = normalize(text) in commands
+}