Fix the cleanup prompt language and harden detection parsing

Review found the detected language was only switching the glossary rule, not
the base prompt: a detected Turkish recording with an English interface got the
English cleanup prompt with a Turkish glossary footnote. Both now follow the
spoken language, and the detected-language value is guarded against a server
that returns something other than a string. The record reply is covered by a
CLI test.
This commit is contained in:
sudoeren
2026-08-27 21:40:09 +03:00
parent 245f00125e
commit 90ae1690ab
4 changed files with 17 additions and 5 deletions
+7
View File
@@ -722,6 +722,13 @@ class Replies(DikteTest):
self.assertEqual(code, 0)
self.assertEqual(out.strip(), "Book it for Thursday.")
def test_the_json_answer_carries_the_detected_language(self):
code, out, _ = self.run_verb(
["--json", "record"],
{"ok": True, "text": "Selam", "speech_language": "tr"})
self.assertEqual(code, 0)
self.assertEqual(json.loads(out)["speech_language"], "tr")
def test_a_dictation_that_failed(self):
code, out, err = self.run_verb(["stop", "--wait"],
{"ok": False, "error": "No speech detected"})