Refactor wake phrase handling: introduce REQUIRE_WAKE_WORD configuration, update documentation, and adjust assistant behavior for improved user experience.
This commit is contained in:
+19
-3
@@ -177,15 +177,31 @@ def spoken(played):
|
||||
def _config(monkeypatch):
|
||||
monkeypatch.setattr(config, "STREAMING_REPLIES", False)
|
||||
monkeypatch.setattr(config, "VAD_RMS_THRESHOLD", 500)
|
||||
monkeypatch.setattr(config, "REQUIRE_WAKE_WORD", False)
|
||||
FakeTranscription.script = []
|
||||
|
||||
|
||||
def test_ignores_speech_without_the_wake_phrase():
|
||||
a, asked, played, logs, _ = make([])
|
||||
def test_ignores_speech_without_the_wake_phrase_when_required():
|
||||
a, asked, played, logs, _ = make([], wake_required=True)
|
||||
say(a, "so anyway I was telling him about the bolt")
|
||||
assert asked == [] and played == []
|
||||
|
||||
|
||||
def test_speech_without_a_wake_phrase_is_a_request_by_default():
|
||||
a, asked, played, logs, _ = make(["It's three o'clock."])
|
||||
say(a, "what time is it?")
|
||||
assert asked[0].startswith("what time is it?\n\n[Bolt Assistant: a voice-only assistant")
|
||||
assert "It's three o'clock." in spoken(played)
|
||||
assert a.state == "idle"
|
||||
|
||||
|
||||
def test_the_banner_says_which_mode_is_on():
|
||||
a, _, _, _, _ = make([])
|
||||
assert "anything you say" in a.listening_banner()
|
||||
required, _, _, _, _ = make([], wake_required=True)
|
||||
assert "Hey Bolt" in required.listening_banner()
|
||||
|
||||
|
||||
def test_wake_phrase_and_request_in_one_breath():
|
||||
a, asked, played, logs, _ = make(["It's three o'clock."])
|
||||
say(a, "Hey Bolt, what time is it?")
|
||||
@@ -205,7 +221,7 @@ def test_bare_wake_phrase_chimes_then_takes_the_next_utterance():
|
||||
|
||||
|
||||
def test_the_command_window_closes():
|
||||
a, asked, played, logs, clock = make([])
|
||||
a, asked, played, logs, clock = make([], wake_required=True)
|
||||
say(a, "Thunderbolt")
|
||||
clock.t += config.COMMAND_WAIT_SEC + 5
|
||||
say(a, "so then we left")
|
||||
|
||||
Reference in New Issue
Block a user