fix: preserve camera permission intent and distinguish unknown reply expression
This commit is contained in:
@@ -412,13 +412,17 @@ fun runChecks() {
|
||||
Payload(turn=turn, fields=mapOf("seq" to seq, "emotion" to kind, "intensity" to strength, "source" to "model"))))
|
||||
}
|
||||
emotion(3, 100)
|
||||
check(states.last().roleLabel == "高兴·明显")
|
||||
check(states.last().replyEmotion.label == "高兴·明显")
|
||||
emotion(3, 99, "angry") // out-of-order same-turn event
|
||||
emotion(2, 101, "angry") // retired turn
|
||||
emotion(99, 102, "angry") // unannounced turn must not advance current turn
|
||||
for (reason in listOf("old_seq", "old_turn", "unannounced_turn")) {
|
||||
check(DebugLogUpload.records.any { it.second.startsWith("role ignore reason=$reason ") })
|
||||
}
|
||||
check(states.last().replyEmotion.label == "高兴·明显")
|
||||
emotion(3, 103, "invalid")
|
||||
check(states.last().replyEmotion.label == "中立")
|
||||
check(states.last().replyEmotion.label == "表达未判定(格式回退)")
|
||||
emotion(3, 104, "sad", 1)
|
||||
check(states.last().replyEmotion.label == "难过·轻度")
|
||||
event(EventKind.TTS, 3, state="stop")
|
||||
@@ -426,16 +430,22 @@ fun runChecks() {
|
||||
check(states.last().replyEmotion.label == "难过·轻度") // tts.stop does not mean native drain
|
||||
checkNotNull(com.gorios.lanvoice.audio.AudioPlayback.lastDrained)(3, 0)
|
||||
Handler.drain()
|
||||
check(states.last().replyEmotion.label == "中立")
|
||||
check(states.last().replyEmotion.turnId == null)
|
||||
check(states.last().roleLabel == "当前未播放")
|
||||
check(states.last().previousReplyEmotion?.label == "难过·轻度")
|
||||
emotion(3, 105) // a late event after drained cannot reanimate the expression
|
||||
check(states.last().replyEmotion.label == "中立")
|
||||
check(DebugLogUpload.records.any { it.second.startsWith("role ignore reason=drained ") })
|
||||
check(states.last().previousReplyEmotion?.label == "难过·轻度")
|
||||
check(states.last().replyEmotion.turnId == null)
|
||||
event(EventKind.ABORT, 4, reason="new_turn")
|
||||
check(states.last().previousReplyEmotion?.label == "难过·轻度")
|
||||
emotion(4, 106)
|
||||
check(states.last().roleLabel == "当前未播放") // accepted expression before PCM is not displayed as playing
|
||||
check(states.last().replyEmotion.label == "高兴·明显")
|
||||
session.interrupt()
|
||||
check(states.last().replyEmotion.label == "中立")
|
||||
check(states.last().replyEmotion.turnId == null)
|
||||
event(EventKind.ABORT, 4, reason="client_abort")
|
||||
check(states.last().replyEmotion.label == "中立")
|
||||
check(states.last().replyEmotion.turnId == null)
|
||||
event(EventKind.UNKNOWN, 4)
|
||||
event(EventKind.ABORT, 4, reason="new_turn")
|
||||
check(blockedField.get(session) == null)
|
||||
@@ -471,6 +481,17 @@ fun runChecks() {
|
||||
}
|
||||
|
||||
fun main() {
|
||||
run {
|
||||
val normal = com.gorios.lanvoice.dialogue.ReplyEmotion.fromWire(2L, 1L, "neutral", 0, "model")!!
|
||||
val fallback = com.gorios.lanvoice.dialogue.ReplyEmotion.fromWire(2L, 1L, "neutral", 0, "fallback", "invalid_intensity")!!
|
||||
val empty = com.gorios.lanvoice.audio.VoiceUiState()
|
||||
check(empty.roleLabel == "当前未播放")
|
||||
check(empty.copy(voiceActive=true, phase=com.gorios.lanvoice.audio.VoicePhase.THINKING, replyEmotion=normal).roleLabel == "等待回复")
|
||||
check(empty.copy(phase=com.gorios.lanvoice.audio.VoicePhase.ANSWERING, replyEmotion=normal).roleLabel == "中立")
|
||||
check(empty.copy(phase=com.gorios.lanvoice.audio.VoicePhase.ANSWERING, replyEmotion=fallback).roleLabel == "表达未判定(格式回退)")
|
||||
check(fallback.reason.wire == "invalid_intensity")
|
||||
}
|
||||
|
||||
try { runChecks() } catch (error: Throwable) {
|
||||
error.printStackTrace()
|
||||
kotlin.system.exitProcess(1)
|
||||
|
||||
Reference in New Issue
Block a user