possible fix for word of the day

This commit is contained in:
Jacob Dubin
2026-04-18 22:14:28 -05:00
parent d4dbfefa06
commit b77f332350
15 changed files with 4444 additions and 3 deletions

View File

@@ -227,9 +227,13 @@ public sealed class JiboInteractionService(
return new JiboInteractionDecision(
"word_of_the_day",
"Starting word of the day.",
"@be/word-of-the-day",
SkillPayload: new Dictionary<string, object?>(StringComparer.OrdinalIgnoreCase)
{
["destination"] = "word-of-the-day"
["destination"] = "word-of-the-day",
["skillId"] = "@be/word-of-the-day",
["redirectIntent"] = "menu",
["redirectDomain"] = "word-of-the-day"
});
}

View File

@@ -306,8 +306,13 @@ public sealed class ResponsePlanToSocketMessagesMapper
var isJoke = string.Equals(plan.IntentName, "joke", StringComparison.OrdinalIgnoreCase) ||
string.Equals(skill?.SkillName, "@be/joke", StringComparison.OrdinalIgnoreCase);
var isDance = string.Equals(plan.IntentName, "dance", StringComparison.OrdinalIgnoreCase);
if (isWordOfTheDay)
{
return BuildWordOfTheDayLaunchSkillPayload(transId, skillPayload);
}
var payloadSkill = ReadPayloadString(skillPayload, "skillId");
var skillId = isWordOfTheDay ? "@be/word-of-the-day" : string.IsNullOrWhiteSpace(payloadSkill) ? isJoke ? "@be/joke" : skill?.SkillName ?? "chitchat-skill" : payloadSkill;
var skillId = string.IsNullOrWhiteSpace(payloadSkill) ? isJoke ? "@be/joke" : skill?.SkillName ?? "chitchat-skill" : payloadSkill;
var esml = ReadPayloadString(skillPayload, "esml") ?? (isDance
? "<speak>Okay.<break size='0.2'/> Watch this.<anim cat='dance' filter='music, rom-upbeat' /></speak>"
: isJoke
@@ -358,6 +363,56 @@ public sealed class ResponsePlanToSocketMessagesMapper
};
}
private static object BuildWordOfTheDayLaunchSkillPayload(string transId, IDictionary<string, object?>? payload)
{
var skillId = ReadPayloadString(payload, "skillId") ?? "@be/word-of-the-day";
var redirectIntent = ReadPayloadString(payload, "redirectIntent") ?? "menu";
var redirectDomain = ReadPayloadString(payload, "redirectDomain") ?? "word-of-the-day";
return new
{
type = "SKILL_ACTION",
ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
msgID = CreateHubMessageId(),
transID = transId,
data = new
{
skill = new
{
id = skillId
},
action = new
{
config = new
{
jcp = new
{
type = "REDIRECT",
config = new
{
nlu = new
{
intent = redirectIntent,
entities = new
{
domain = redirectDomain
}
},
asr = new
{
text = string.Empty,
confidence = 1.0
}
}
}
}
},
analytics = new Dictionary<string, object?>(),
final = true
}
};
}
private static object BuildGenericFallbackSkillPayload(string transId)
{
return new