Port legacy persona and emotion replies

This commit is contained in:
Jacob Dubin
2026-05-14 06:44:22 -05:00
parent 66b89f3cee
commit 7297017250
12 changed files with 48555 additions and 20 deletions

View File

@@ -20,7 +20,9 @@ public sealed class LegacyMimCatalogImporterTests
Assert.Contains("No, I'm one in one million.", catalog.PersonalityReplies);
Assert.Contains("I know a lot, I think. But not as much as I will someday.", catalog.PersonalityReplies);
Assert.Contains("I don't think of it as a job, because it's more fun than a job. But I'm here to help you out, and have fun with you, and maybe get my head patted by you occasionally.", catalog.PersonalityReplies);
Assert.Contains("All systems are go.", catalog.HowAreYouReplies);
Assert.Contains(catalog.EmotionReplies, reply =>
reply.Condition.Contains("NEUTRAL", StringComparison.OrdinalIgnoreCase) &&
reply.Reply.Contains("All systems are go.", StringComparison.OrdinalIgnoreCase));
Assert.Contains("A Jibo is a robot. But I'm not just a machine, I have a heart. Well, not a real heart. But feelings. Well, not human feelings. You know what I mean.", catalog.PersonalityReplies);
}
finally
@@ -49,6 +51,9 @@ public sealed class LegacyMimCatalogImporterTests
Assert.Contains("I think only you can answer that question.", merged.PersonalityReplies);
Assert.Contains("People in Boston made me. It was a pretty cool project.", merged.PersonalityReplies);
Assert.Contains("From what I understand, robots don't ever pay anything.", merged.PersonalityReplies);
Assert.Contains(merged.EmotionReplies, reply =>
reply.Condition.Contains("NEUTRAL", StringComparison.OrdinalIgnoreCase) &&
reply.Reply.Contains("All systems are go.", StringComparison.OrdinalIgnoreCase));
}
finally
{
@@ -64,7 +69,8 @@ public sealed class LegacyMimCatalogImporterTests
var catalog = await repository.GetCatalogAsync();
Assert.Contains("I think only you can answer that question.", catalog.PersonalityReplies);
Assert.Contains("All systems are go.", catalog.HowAreYouReplies);
Assert.Contains(catalog.EmotionReplies, reply =>
reply.Condition.Contains("NEUTRAL", StringComparison.OrdinalIgnoreCase));
Assert.Contains("Something's off with the connection to my sources. Maybe ask me again in a little while.", catalog.GenericFallbackReplies);
}

View File

@@ -266,6 +266,31 @@ public sealed class JiboInteractionServiceTests
Assert.Equal("I do. I am curious, playful, and always up for a new experiment.", decision.ReplyText);
}
[Theory]
[InlineData("do you pay taxes", "robot_taxes", "From what I understand, robots don't ever pay anything.")]
[InlineData("what do you want", "robot_desire", "Socializing and electricity. I'd also be happy if everyone in the world was nicer to each other. It seems like they should be.")]
[InlineData("what's your name", "robot_name", "Jibo. Just Jibo, no last name. Like Bono")]
[InlineData("who made you", "robot_origin_created", "My story is pretty typical. Some people wanted to create something that would really help people. So they built a robot.")]
[InlineData("where are you from", "robot_origin_from", "Some people think I come from the moon. But they're wrong, I'm from Boston.")]
public async Task BuildDecisionAsync_LegacyBuildAQuestions_UseImportedScriptedReplies(
string transcript,
string expectedIntent,
string expectedReply)
{
var service = CreateService();
var decision = await service.BuildDecisionAsync(new TurnContext
{
RawTranscript = transcript,
NormalizedTranscript = transcript
});
Assert.Equal(expectedIntent, decision.IntentName);
Assert.Equal(expectedReply, decision.ReplyText);
Assert.Null(decision.SkillName);
Assert.Equal("ScriptedResponse", decision.ContextUpdates![ChitchatRouteKey]);
}
[Fact]
public async Task BuildDecisionAsync_Hello_RoutesThroughChitchatScriptedResponse()
{
@@ -300,6 +325,27 @@ public sealed class JiboInteractionServiceTests
Assert.Equal(string.Empty, decision.ContextUpdates[ChitchatEmotionKey]);
}
[Fact]
public async Task BuildDecisionAsync_AreYouHappy_UsesLegacyEmotionResponseWhenEmotionIsKnown()
{
var service = CreateService();
var decision = await service.BuildDecisionAsync(new TurnContext
{
RawTranscript = "are you happy",
NormalizedTranscript = "are you happy",
Attributes = new Dictionary<string, object?>
{
[ChitchatEmotionKey] = "happy"
}
});
Assert.Equal("emotion_query", decision.IntentName);
Assert.Equal("Yes indeed. Never been better.", decision.ReplyText);
Assert.NotNull(decision.ContextUpdates);
Assert.Equal("EmotionQuery", decision.ContextUpdates![ChitchatRouteKey]);
}
[Fact]
public async Task BuildDecisionAsync_Smile_RoutesThroughEmotionCommandSplit()
{