yes no fix and better wod answers
This commit is contained in:
@@ -76,6 +76,26 @@ public sealed class JiboInteractionServiceTests
|
||||
Assert.Equal("Yes.", decision.ReplyText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_YesNoFollowUp_FromAsrHints_MapsShortDenialToNoIntent()
|
||||
{
|
||||
var service = CreateService();
|
||||
|
||||
var decision = await service.BuildDecisionAsync(new TurnContext
|
||||
{
|
||||
RawTranscript = "no",
|
||||
NormalizedTranscript = "no",
|
||||
Attributes = new Dictionary<string, object?>
|
||||
{
|
||||
["listenRules"] = new[] { "surprises-ota/want_to_download_now" },
|
||||
["listenAsrHints"] = new[] { "$YESNO" }
|
||||
}
|
||||
});
|
||||
|
||||
Assert.Equal("no", decision.IntentName);
|
||||
Assert.Equal("No.", decision.ReplyText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_SkillPhraseVariant_MapsToKnownIntent()
|
||||
{
|
||||
@@ -172,6 +192,27 @@ public sealed class JiboInteractionServiceTests
|
||||
Assert.Equal("completion_only", decision.SkillPayload["cloudResponseMode"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_WordOfDayGuess_FuzzyMatchesClosestHint()
|
||||
{
|
||||
var service = CreateService();
|
||||
|
||||
var decision = await service.BuildDecisionAsync(new TurnContext
|
||||
{
|
||||
RawTranscript = "Haglet.",
|
||||
NormalizedTranscript = "Haglet.",
|
||||
Attributes = new Dictionary<string, object?>
|
||||
{
|
||||
["listenRules"] = new[] { "word-of-the-day/puzzle" },
|
||||
["listenAsrHints"] = new[] { "aglet", "hovel", "wisenheimer" }
|
||||
}
|
||||
});
|
||||
|
||||
Assert.Equal("word_of_the_day_guess", decision.IntentName);
|
||||
Assert.Equal("I heard aglet.", decision.ReplyText);
|
||||
Assert.Equal("aglet", decision.SkillPayload!["guess"]);
|
||||
}
|
||||
|
||||
private static JiboInteractionService CreateService()
|
||||
{
|
||||
return new JiboInteractionService(
|
||||
|
||||
@@ -373,6 +373,34 @@ public sealed class JiboWebSocketServiceTests
|
||||
Assert.Equal("create/is_it_a_keeper", listenPayload.RootElement.GetProperty("data").GetProperty("match").GetProperty("rule").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ClientAsr_YesNoPromptFromAsrHints_MapsShortDenialToNoIntent()
|
||||
{
|
||||
await _service.HandleMessageAsync(new WebSocketMessageEnvelope
|
||||
{
|
||||
HostName = "neo-hub.jibo.com",
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = "hub-yesno-hints-token",
|
||||
Text = """{"type":"LISTEN","transID":"trans-yesno-hints","data":{"rules":["surprises-ota/want_to_download_now"],"asr":{"hints":["$YESNO"]}}}"""
|
||||
});
|
||||
|
||||
var replies = await _service.HandleMessageAsync(new WebSocketMessageEnvelope
|
||||
{
|
||||
HostName = "neo-hub.jibo.com",
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = "hub-yesno-hints-token",
|
||||
Text = """{"type":"CLIENT_ASR","transID":"trans-yesno-hints","data":{"text":"no"}}"""
|
||||
});
|
||||
|
||||
Assert.Equal(3, replies.Count);
|
||||
|
||||
using var listenPayload = JsonDocument.Parse(replies[0].Text!);
|
||||
Assert.Equal("no", listenPayload.RootElement.GetProperty("data").GetProperty("asr").GetProperty("text").GetString());
|
||||
Assert.Equal("no", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("intent").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ClientNlu_WordOfDayGuess_UsesGuessEntityAsAsrTextAndCompletesTurn()
|
||||
{
|
||||
@@ -468,6 +496,35 @@ public sealed class JiboWebSocketServiceTests
|
||||
Assert.Equal("SKILL_ACTION", ReadReplyType(replies[2]));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ClientAsr_WordOfDayGuess_FuzzyMatchesClosestHint()
|
||||
{
|
||||
await _service.HandleMessageAsync(new WebSocketMessageEnvelope
|
||||
{
|
||||
HostName = "neo-hub.jibo.com",
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = "hub-wod-fuzzy-guess-token",
|
||||
Text = """{"type":"LISTEN","transID":"trans-wod-fuzzy-guess","data":{"rules":["word-of-the-day/puzzle"],"asr":{"hints":["aglet","hovel","wisenheimer"]}}}"""
|
||||
});
|
||||
|
||||
var replies = await _service.HandleMessageAsync(new WebSocketMessageEnvelope
|
||||
{
|
||||
HostName = "neo-hub.jibo.com",
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = "hub-wod-fuzzy-guess-token",
|
||||
Text = """{"type":"CLIENT_ASR","transID":"trans-wod-fuzzy-guess","data":{"text":"Haglet."}}"""
|
||||
});
|
||||
|
||||
Assert.Equal(3, replies.Count);
|
||||
|
||||
using var listenPayload = JsonDocument.Parse(replies[0].Text!);
|
||||
Assert.Equal("aglet", listenPayload.RootElement.GetProperty("data").GetProperty("asr").GetProperty("text").GetString());
|
||||
Assert.Equal("aglet", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("entities").GetProperty("guess").GetString());
|
||||
Assert.Equal("SKILL_ACTION", ReadReplyType(replies[2]));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ClientAsr_WordOfDayLaunch_EmitsMenuStyleLoadMenuAndRedirect()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user