feat: merge reply emotions while preserving configurable Qwen/Doubao provider

This commit is contained in:
zenord
2026-10-12 10:57:14 +08:00
parent 19a7adccd9
commit d43c7d4e80
36 changed files with 1264 additions and 98 deletions
+27
View File
@@ -407,8 +407,35 @@ fun runChecks() {
frameMethod.invoke(session, DownlinkFrame(turnId=3))
check(com.gorios.lanvoice.audio.AudioPlayback.enqueued == beforeFrames + 4)
check(states.last().phase == com.gorios.lanvoice.audio.VoicePhase.ANSWERING)
fun emotion(turn: Long, seq: Long, kind: String = "happy", strength: Int = 2) {
eventMethod.invoke(session, ServerEvent("reply.emotion", EventKind.REPLY_EMOTION,
Payload(turn=turn, fields=mapOf("seq" to seq, "emotion" to kind, "intensity" to strength, "source" to "model"))))
}
emotion(3, 100)
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
check(states.last().replyEmotion.label == "高兴·明显")
emotion(3, 103, "invalid")
check(states.last().replyEmotion.label == "中立")
emotion(3, 104, "sad", 1)
check(states.last().replyEmotion.label == "难过·轻度")
event(EventKind.TTS, 3, state="stop")
check(states.last().phase == com.gorios.lanvoice.audio.VoicePhase.ANSWERING)
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 == "中立")
emotion(3, 105) // a late event after drained cannot reanimate the expression
check(states.last().replyEmotion.label == "中立")
event(EventKind.ABORT, 4, reason="new_turn")
emotion(4, 106)
check(states.last().replyEmotion.label == "高兴·明显")
session.interrupt()
check(states.last().replyEmotion.label == "中立")
event(EventKind.ABORT, 4, reason="client_abort")
check(states.last().replyEmotion.label == "中立")
event(EventKind.UNKNOWN, 4)
event(EventKind.ABORT, 4, reason="new_turn")
check(blockedField.get(session) == null)