mirror of
https://github.com/Louis-CFM/coucou.git
synced 2026-12-07 07:32:35 +09:00
A — Conversation doesn't resume (root cause fix) - VoiceEngine.startListeningDirectly: close existing spotter window before opening a new one (TTS audio → VAD leaves window open → beginWindow returns false/alreadyActive → island waits 8 s then closes) - Retry beginWindow once after 150 ms if still refused; give up with log - onVoiceStart: ignore VAD trigger while VoiceSpeaker.isSpeaking (TTS voice calibrated VAD on wrong audio) - WakeSpotter.isActive property exposed for engine to check - scheduleConversationContinue: play tick.wav + post BotEmote.listening so Mochi shows listening state when re-listening starts B — False activations - WakeSpotter: additionalContextualStrings (pill names) only added to contextualStrings when startInCommandPhase=true, never on wake windows - IslandWindowController: ignore transcripts < 2 words during conversation unless it's a known pill name or parseable command (spurious VAD blip) - Max 1 "pas compris" spoken per conversation (hasSpokenPasCompris flag) - End conversation silently after 2 consecutive failures C — Understanding improvements - IntentParser fillers: pile, piles, aussi, stp - IntentParser articles: pile, piles added to stripArticles/Raw - New add triggers: "je veux X", "il me faut X" (il filtered → me faut) - New remove triggers: vire, dégage, enlève-moi, plus besoin de - parseMultiAction: comma-splits before conjunction-splits - ConversationContext: "et X", "X aussi", "ajoute aussi X", bare pill name all resolve to same-action (or default pillAdd with no prior) D — Local transcript debug history - VoiceTranscriptHistory: in-memory circular buffer (20 entries), records transcript + intent + origin (parser/context/brain) - Settings → Voice: "Dernières phrases entendues" section with Copy and Clear buttons (only visible when entries exist) Tests: all scripts green (133/133 intent, ConversationContext, runner, voice conversation, TurnEndPolicy). Both NotchBuddy and CoucouAppStore Release builds succeed with no errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
75 lines
2.7 KiB
Swift
75 lines
2.7 KiB
Swift
import Foundation
|
|
|
|
@main
|
|
enum ConversationContextTests {
|
|
static let pills = PillFixture.available
|
|
|
|
static func main() {
|
|
testNoContextReturnsNil()
|
|
testSameTarget_aussiFR()
|
|
testSameTarget_pareilPour()
|
|
testSameTarget_also()
|
|
testReverse_pillAdd()
|
|
testReverse_musicPause()
|
|
testUnknownNotStored()
|
|
print("ConversationContextTests: all cases passed")
|
|
}
|
|
|
|
static func testNoContextReturnsNil() {
|
|
let ctx = ConversationContext()
|
|
// "et X aussi" with no prior action defaults to pillAdd (new: bare pill / relative patterns → add)
|
|
precondition(ctx.resolveRelative("et Vercel aussi", pills: pills) == .pillAdd(id: "integration_vercel"),
|
|
"et X aussi without context → pillAdd X")
|
|
// Truly unknown non-relative phrase → nil
|
|
precondition(ctx.resolveRelative("xyz blabla blah", pills: pills) == nil,
|
|
"unknown phrase without context → nil")
|
|
}
|
|
|
|
static func testSameTarget_aussiFR() {
|
|
var ctx = ConversationContext()
|
|
ctx.update(.pillAdd(id: "integration_github"))
|
|
let r = ctx.resolveRelative("et vercel aussi", pills: pills)
|
|
precondition(r == .pillAdd(id: "integration_vercel"),
|
|
"et X aussi → pillAdd with X")
|
|
}
|
|
|
|
static func testSameTarget_pareilPour() {
|
|
var ctx = ConversationContext()
|
|
ctx.update(.pillRemove(id: "integration_github"))
|
|
let r = ctx.resolveRelative("pareil pour stripe", pills: pills)
|
|
precondition(r == .pillRemove(id: "integration_stripe"),
|
|
"pareil pour X → pillRemove with X")
|
|
}
|
|
|
|
static func testSameTarget_also() {
|
|
var ctx = ConversationContext()
|
|
ctx.update(.pillAdd(id: "integration_vercel"))
|
|
let r = ctx.resolveRelative("also stripe", pills: pills)
|
|
precondition(r == .pillAdd(id: "integration_stripe"),
|
|
"also X → pillAdd with X")
|
|
}
|
|
|
|
static func testReverse_pillAdd() {
|
|
var ctx = ConversationContext()
|
|
ctx.update(.pillAdd(id: "integration_github"))
|
|
let r = ctx.resolveRelative("annule ca", pills: pills)
|
|
precondition(r == .pillRemove(id: "integration_github"),
|
|
"annule ca after pillAdd → pillRemove")
|
|
}
|
|
|
|
static func testReverse_musicPause() {
|
|
var ctx = ConversationContext()
|
|
ctx.update(.musicPause)
|
|
let r = ctx.resolveRelative("undo", pills: pills)
|
|
precondition(r == .musicPlay(target: nil),
|
|
"undo after musicPause → musicPlay")
|
|
}
|
|
|
|
static func testUnknownNotStored() {
|
|
var ctx = ConversationContext()
|
|
ctx.update(.unknown)
|
|
precondition(ctx.lastIntent == nil,
|
|
".unknown should not be stored in context")
|
|
}
|
|
}
|