Add proactive fun facts, jokes, and current location
This commit is contained in:
@@ -178,6 +178,25 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
reply.Contains("robot stuff", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ImportCatalog_ImportsBuildBFunFactAndJokeResponsesIntoRandomizationBuckets()
|
||||
{
|
||||
var rootDirectory = Path.Combine(
|
||||
AppContext.BaseDirectory,
|
||||
"Content",
|
||||
"LegacyMims",
|
||||
"BuildB");
|
||||
|
||||
var catalog = LegacyMimCatalogImporter.ImportCatalog(rootDirectory);
|
||||
|
||||
Assert.Contains("I love jokes. Did you hear about the theater actor who fell through the floorboards? He was just going through a stage.",
|
||||
catalog.Jokes);
|
||||
Assert.Contains("Sure I got one. What did the zero say to the eight. Nice belt.", catalog.Jokes);
|
||||
Assert.Contains("Here's an interesting fact about me. I have two cameras but they're different focal lengths. One's for far things, and the other's for near things.",
|
||||
catalog.FunFacts);
|
||||
Assert.Contains("True fact. Children have more taste buds than grown ups.", catalog.FunFacts);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ImportCatalog_ImportsBuildBRnGreetingResponsesIntoGreetingBucket()
|
||||
{
|
||||
@@ -465,4 +484,4 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
|
||||
return rootDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,6 +496,26 @@ public sealed class JiboInteractionServiceTests
|
||||
Assert.Equal("ScriptedResponse", decision.ContextUpdates![ChitchatRouteKey]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_CurrentLocation_UsesRuntimeLocationName()
|
||||
{
|
||||
var service = CreateService();
|
||||
|
||||
var decision = await service.BuildDecisionAsync(new TurnContext
|
||||
{
|
||||
RawTranscript = "what is our current location",
|
||||
NormalizedTranscript = "what is our current location",
|
||||
Attributes = new Dictionary<string, object?>
|
||||
{
|
||||
["context"] = """{"runtime":{"location":{"name":"Houston"}}}"""
|
||||
}
|
||||
});
|
||||
|
||||
Assert.Equal("current_location", decision.IntentName);
|
||||
Assert.Contains("Houston", decision.ReplyText, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Equal("ScriptedResponse", decision.ContextUpdates![ChitchatRouteKey]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_Hello_RoutesThroughChitchatScriptedResponse()
|
||||
{
|
||||
@@ -2842,6 +2862,63 @@ public sealed class JiboInteractionServiceTests
|
||||
Assert.Equal("Do you want to hear a fun pizza fact?", decision.ReplyText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_SurprisesOtaPrompt_StaysDistinctFromPizzaProactivity()
|
||||
{
|
||||
var service = CreateService();
|
||||
|
||||
var decision = await service.BuildDecisionAsync(new TurnContext
|
||||
{
|
||||
RawTranscript = "yes",
|
||||
NormalizedTranscript = "yes",
|
||||
Attributes = new Dictionary<string, object?>
|
||||
{
|
||||
["listenRules"] = (string[])["surprises-ota/want_to_download_now", "globals/global_commands_launch"],
|
||||
["listenAsrHints"] = (string[])["$YESNO"]
|
||||
}
|
||||
});
|
||||
|
||||
Assert.Equal("yes", decision.IntentName);
|
||||
Assert.Equal("Yes.", decision.ReplyText);
|
||||
Assert.NotEqual("proactive_offer_pizza_fact", decision.IntentName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_SomethingFunOffer_MapsToFunFactIntent()
|
||||
{
|
||||
var service = CreateService();
|
||||
|
||||
var decision = await service.BuildDecisionAsync(new TurnContext
|
||||
{
|
||||
RawTranscript = "hey can i tell you something kind of fun",
|
||||
NormalizedTranscript = "hey can i tell you something kind of fun"
|
||||
});
|
||||
|
||||
Assert.Equal("proactive_fun_fact", decision.IntentName);
|
||||
Assert.NotNull(decision.ReplyText);
|
||||
Assert.NotEmpty(decision.ReplyText);
|
||||
Assert.Equal("chitchat-skill", decision.SkillName);
|
||||
Assert.Equal("fun_fact", decision.SkillPayload!["replyType"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_Surprise_DefaultsToAFunFactWhenNoPizzaSignalExists()
|
||||
{
|
||||
var service = CreateService();
|
||||
|
||||
var decision = await service.BuildDecisionAsync(new TurnContext
|
||||
{
|
||||
RawTranscript = "surprise me",
|
||||
NormalizedTranscript = "surprise me"
|
||||
});
|
||||
|
||||
Assert.Equal("proactive_fun_fact", decision.IntentName);
|
||||
Assert.Equal("chitchat-skill", decision.SkillName);
|
||||
Assert.Equal("fun_fact", decision.SkillPayload!["replyType"]);
|
||||
Assert.NotNull(decision.ReplyText);
|
||||
Assert.NotEmpty(decision.ReplyText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BuildDecisionAsync_WordOfDayOfferPrompt_WithNoisyAffirmation_MapsToWordOfDayLaunch()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed class JiboWebSocketServiceTests
|
||||
var contentRepository = new InMemoryJiboExperienceContentRepository();
|
||||
var contentCache = new JiboExperienceContentCache(contentRepository);
|
||||
var conversationBroker = new DemoConversationBroker(new JiboInteractionService(contentCache,
|
||||
new DefaultJiboRandomizer(), new InMemoryPersonalMemoryStore()));
|
||||
new LastItemRandomizer(), new InMemoryPersonalMemoryStore()));
|
||||
var sttSelector = new DefaultSttStrategySelector(
|
||||
[
|
||||
new SyntheticBufferedAudioSttStrategy()
|
||||
@@ -5111,4 +5111,12 @@ public sealed class JiboWebSocketServiceTests
|
||||
return Task.FromResult<NewsBriefingSnapshot?>(snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class LastItemRandomizer : IJiboRandomizer
|
||||
{
|
||||
public T Choose<T>(IReadOnlyList<T> items)
|
||||
{
|
||||
return items[^1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user