From 5c2a32491b4976a758d06427ab33fb8cb17bea73 Mon Sep 17 00:00:00 2001 From: Cutshion Date: Fri, 23 Oct 2026 17:50:56 +0900 Subject: [PATCH] Fix song selection and interruptions Co-Authored-By: Claude Opus 5.5 --- audio/sing.py | 43 ++++++++++++++++++++++++++++++++++++++----- tests/test_songs.py | 16 ++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/audio/sing.py b/audio/sing.py index 74da13a..620e00c 100644 --- a/audio/sing.py +++ b/audio/sing.py @@ -55,7 +55,8 @@ SONG_WORD = re.compile(r"\bsing|\bsong|\bmusic|\btunes?\b|\bplaylist|k-?pop|노 SING = re.compile(r"\bsing\b|\bsay (?:a |some )?songs?\b|" # whisper writes "let's say song" r"\b(?:play|put on|turn on|start)(?: me| us)? (?:a |some |any |another |the |your )?(?:songs?|music|tunes?)\b|" - r"\b(?:another|different|next|new|other) (?:song|tune)\b|\b(?:want|like|love) to hear (?:a |some )?(?:song|music)\b|" + r"\b(?:another|different|next|new|other) (?:song|tune)\b|\b(?:change|switch)(?: the| this| that)? (?:songs?|music|tunes?)\b|" + r"(?:노래|음악|곡)\s*(?:좀\s*)?바꿔|\b(?:want|like|love) to hear (?:a |some )?(?:song|music)\b|" r"^\W*(?:lumi\W*)?(?:a |some )?(?:song|music)(?:\W+(?:please|lumi))*\W*$|" r"(?:노래|음악|(? 4.5 and L.pending_text is None @@ -228,6 +229,21 @@ assert sung[-1] == ("sing", "그거 말고"), sung L.brain.history = [] L.answer("what songs can you sing?") assert "Which one would you like?" in said[-1] and L.brain.history[-1][1].startswith("ACTION: none songs"), said +# live 2026-10-23: after the list a title or a place in it starts that song, never an LLM "Okay, I'll play it" +for words in ("Let's put the first one.", "Fantastic Baby.", "아무거나", "두 번째 거 불러 줘", "the last one"): + L.answer(words) + assert sung[-1] == ("sing", words), (words, sung) + L.brain.history = L.brain.history[:-1] + [("what songs can you sing?", "ACTION: none songs\n" + said[-1])] +listed = "ACTION: none songs\nI can sing ..." +assert sing.picked("Let's put the first one.", listed) == B and sing.picked("Fantastic Baby.", listed) == F +assert sing.picked("두 번째 거", listed) == F and sing.picked("세 번째", listed) == D and sing.picked("the last one", listed) == L_ +assert sing.picked("마지막 거", listed) == L_ and sing.picked("판타스틱", listed) == F and sing.picked("아무거나", listed) in SONGS +assert sing.picked("first one", "ACTION: none -\nOkay.") is None and sing.picked("go to p3", listed) is None +assert sing.picked("don't sing the first one", listed) is None +assert sing.asked("Let's change music.") and sing.choose("Let's change music.", last=B) not in (None, B) # not "not ours" +assert sing.asked("노래 바꿔 줘") and sing.choose("노래 바꿔 줘", last=B) not in (None, B) +assert lumi.brain_mod.promised("Okay, I'll play it.") == "sing" and lumi.brain_mod.promised("판타스틱 베이비 틀어 드릴게요.") == "sing" +assert lumi.mouth.sentences("我会唱歌。 Okay! 好的") == ["Okay!"] and lumi.mouth.sentences("你好") == [] lumi.ears.understood = lambda *a: False # English words tagged 'korean' (logs/lumi.log 2026-10-21 11:30) lumi.ears.heard_clearly = lambda *a: True lumi.ears.last_stt = {"language": "korean", "logprob": -0.08}