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

fix(ask): a choice card's question and answer now land in the scrollback

booboosui13dc35740aca
diff --git a/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt b/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt
index 603df25..d6e93fe 100644
--- a/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt
+++ b/app/src/main/java/net/kuafuai/andee/net/CommandDispatcher.kt
@@ -781,6 +781,13 @@ class CommandDispatcher(
net.kuafuai.andee.ui.CardUi.ask(question, buttons, timeoutMs, captureSpeech = true) { r ->
answer = r; latch.countDown()
}
+ // The question and the answer are part of the conversation, so
+ // they go in the scrollback like any other exchange. Without this
+ // the card came and went and the list showed the brain acting on
+ // a choice nobody could see being made.
+ net.kuafuai.andee.ui.ChatHistory.addAssistant(
+ net.kuafuai.andee.brain.SpeechMood.parse(question).text,
+ )
// The card is up in the user's hands, but they may be looking
// anywhere else — the ball is a voice-first device, so the
// question is spoken as well as shown. The service applies the
@@ -790,6 +797,11 @@ class CommandDispatcher(
sayAloud(question, true)
latch.await(timeoutMs + 3000, java.util.concurrent.TimeUnit.MILLISECONDS)
val r = answer ?: net.kuafuai.andee.ui.CardUi.Result(null, "no_answer")
+ // A timeout or a superseded card is no answer, and writing one
+ // would put words in the user's mouth.
+ (r.button ?: r.heard)?.takeIf { it.isNotBlank() }?.let {
+ net.kuafuai.andee.ui.ChatHistory.addUser(it)
+ }
org.json.JSONObject()
.put("button", r.button)
.put("how", r.how)