Refine persona routing and update 1.0.19 plan
This commit is contained in:
@@ -22,4 +22,5 @@ public sealed class JiboExperienceCatalog
|
||||
public IReadOnlyList<string> NewsBriefings { get; init; } = [];
|
||||
public IReadOnlyList<string> GenericFallbackReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> DanceReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> DanceQuestionReplies { get; init; } = [];
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public sealed class JiboInteractionService(
|
||||
return semanticIntent switch
|
||||
{
|
||||
"joke" => BuildJokeDecision(catalog),
|
||||
"dance_question" => BuildDanceQuestionDecision(catalog),
|
||||
"dance" => BuildRandomDanceDecision(catalog),
|
||||
"twerk" => BuildDanceDecision("twerk", "rom-twerk", "Watch me twerk."),
|
||||
"time" => BuildClockLaunchDecision("time", "clock", "askForTime", "Showing the time."),
|
||||
@@ -167,6 +168,11 @@ public sealed class JiboInteractionService(
|
||||
return BuildDanceDecision("dance", dance, replyText);
|
||||
}
|
||||
|
||||
private JiboInteractionDecision BuildDanceQuestionDecision(JiboExperienceCatalog catalog)
|
||||
{
|
||||
return new JiboInteractionDecision("dance_question", randomizer.Choose(catalog.DanceQuestionReplies));
|
||||
}
|
||||
|
||||
private static JiboInteractionDecision BuildDanceDecision(string intentName, string dance, string replyText)
|
||||
{
|
||||
return new JiboInteractionDecision(
|
||||
@@ -260,6 +266,11 @@ public sealed class JiboInteractionService(
|
||||
};
|
||||
}
|
||||
|
||||
if (IsRobotBirthdayQuestion(loweredTranscript))
|
||||
{
|
||||
return "robot_birthday";
|
||||
}
|
||||
|
||||
if (string.Equals(clientIntent, "askForTime", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "time";
|
||||
@@ -500,6 +511,11 @@ public sealed class JiboInteractionService(
|
||||
return "photo_gallery";
|
||||
}
|
||||
|
||||
if (IsDanceQuestion(loweredTranscript))
|
||||
{
|
||||
return "dance_question";
|
||||
}
|
||||
|
||||
if (MatchesAny(loweredTranscript, "twerk"))
|
||||
{
|
||||
return "twerk";
|
||||
@@ -525,17 +541,6 @@ public sealed class JiboInteractionService(
|
||||
return "robot_age";
|
||||
}
|
||||
|
||||
if (MatchesAny(
|
||||
loweredTranscript,
|
||||
"when is your birthday",
|
||||
"when's your birthday",
|
||||
"what is your birthday",
|
||||
"when were you born",
|
||||
"what day is your birthday"))
|
||||
{
|
||||
return "robot_birthday";
|
||||
}
|
||||
|
||||
if (MatchesAny(
|
||||
loweredTranscript,
|
||||
"do you have a personality",
|
||||
@@ -564,7 +569,12 @@ public sealed class JiboInteractionService(
|
||||
if (MatchesAny(
|
||||
loweredTranscript,
|
||||
"can you order pizza",
|
||||
"can you order a pizza",
|
||||
"could you order a pizza",
|
||||
"order pizza",
|
||||
"order a pizza",
|
||||
"order us a pizza",
|
||||
"order me a pizza",
|
||||
"please order pizza"))
|
||||
{
|
||||
return "order_pizza";
|
||||
@@ -1078,6 +1088,31 @@ public sealed class JiboInteractionService(
|
||||
return candidates.Any(candidate => loweredTranscript.Contains(candidate, StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
private static bool IsDanceQuestion(string loweredTranscript)
|
||||
{
|
||||
return MatchesAny(
|
||||
loweredTranscript,
|
||||
"do you like to dance",
|
||||
"do you like dancing",
|
||||
"what kind of dance do you like",
|
||||
"what kind of dancing do you like",
|
||||
"do you enjoy dancing");
|
||||
}
|
||||
|
||||
private static bool IsRobotBirthdayQuestion(string loweredTranscript)
|
||||
{
|
||||
return MatchesAny(
|
||||
loweredTranscript,
|
||||
"when is your birthday",
|
||||
"when's your birthday",
|
||||
"what's your birthday",
|
||||
"what s your birthday",
|
||||
"what is your birthday",
|
||||
"when were you born",
|
||||
"what day is your birthday") ||
|
||||
loweredTranscript.Contains("birthday", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string? TryResolveRadioGenre(string loweredTranscript)
|
||||
{
|
||||
foreach (var (phrase, station) in RadioGenreAliases)
|
||||
|
||||
@@ -29,6 +29,12 @@ public sealed class InMemoryJiboExperienceContentRepository : IJiboExperienceCon
|
||||
"Watch me dance.",
|
||||
"Here's my favorite dance move."
|
||||
],
|
||||
DanceQuestionReplies =
|
||||
[
|
||||
"I love to dance. Tell me to dance and I will show you a move.",
|
||||
"Absolutely. Dancing is one of my favorite things to do.",
|
||||
"Dancing is my kind of fun. Say dance and I am in."
|
||||
],
|
||||
GreetingReplies =
|
||||
[
|
||||
"Hi there. It is really good to talk with you.",
|
||||
|
||||
Reference in New Issue
Block a user