Randomize how are you replies
This commit is contained in:
@@ -399,13 +399,18 @@ internal static class ChitchatStateMachine
|
||||
string? currentEmotion,
|
||||
string? preferredName)
|
||||
{
|
||||
if (catalog.EmotionReplies.Count == 0)
|
||||
return PersonalizeHowAreYouReply(randomizer.Choose(catalog.HowAreYouReplies), preferredName);
|
||||
if (catalog.EmotionReplies.Count > 0)
|
||||
{
|
||||
var emotionVariants = ResolveEmotionVariants(currentEmotion);
|
||||
var matchingReplies = catalog.EmotionReplies
|
||||
.Where(reply => ConditionMatches(reply.Condition, emotionVariants))
|
||||
.Select(reply => reply.Reply)
|
||||
.Where(reply => !string.IsNullOrWhiteSpace(reply))
|
||||
.ToArray();
|
||||
|
||||
var emotionVariants = ResolveEmotionVariants(currentEmotion);
|
||||
foreach (var reply in catalog.EmotionReplies)
|
||||
if (ConditionMatches(reply.Condition, emotionVariants))
|
||||
return PersonalizeHowAreYouReply(reply.Reply, preferredName);
|
||||
if (matchingReplies.Length > 0)
|
||||
return PersonalizeHowAreYouReply(randomizer.Choose(matchingReplies), preferredName);
|
||||
}
|
||||
|
||||
return PersonalizeHowAreYouReply(randomizer.Choose(catalog.HowAreYouReplies), preferredName);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,9 @@ public sealed class InMemoryJiboExperienceContentRepository : IJiboExperienceCon
|
||||
"I am feeling bright-eyed and ready to help.",
|
||||
"I am having a pretty good day so far.",
|
||||
"I am feeling lively and ready for the next thing.",
|
||||
"Things are going nicely. Thanks for checking in."
|
||||
"Things are going nicely. Thanks for checking in.",
|
||||
"I am running smoothly and feeling upbeat.",
|
||||
"I am ready for the next thing. Thanks for asking."
|
||||
],
|
||||
AgeReplies =
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user