more word of the day fixes

This commit is contained in:
Jacob Dubin
2026-04-19 21:03:41 -05:00
parent cedf08b422
commit 1310bf47e3
14 changed files with 7577 additions and 8 deletions

View File

@@ -93,6 +93,9 @@ public sealed class ResponsePlanToSocketMessagesMapper
outboundRules,
entities)),
DelayMs: 75));
messages.Add(new SocketReplyPlan(
JsonSerializer.Serialize(BuildCompletionOnlySkillPayload(transId, "@be/word-of-the-day")),
DelayMs: 125));
}
if (emitSkillActions && speak is not null)
@@ -192,6 +195,27 @@ public sealed class ResponsePlanToSocketMessagesMapper
];
}
public static IReadOnlyList<SocketReplyPlan> MapNoInputAndRedirectToSkill(
string transId,
IReadOnlyList<string> rules,
string skillId,
int redirectDelayMs = 75)
{
var messages = new List<SocketReplyPlan>(MapNoInput(transId, rules))
{
new(JsonSerializer.Serialize(BuildSkillRedirectPayload(
transId,
skillId,
string.Empty,
string.Empty,
[],
new Dictionary<string, object?>())),
redirectDelayMs)
};
return messages;
}
private static IReadOnlyList<string> ReadRules(TurnContext turn, string? messageType)
{
var attributeName = string.Equals(messageType, "CLIENT_NLU", StringComparison.OrdinalIgnoreCase)

View File

@@ -150,9 +150,10 @@ public sealed class WebSocketTurnFinalizationService(
ResetBufferedAudio(session);
session.TurnState.SawListen = false;
session.TurnState.SawContext = false;
return ResponsePlanToSocketMessagesMapper.MapNoInput(
return ResponsePlanToSocketMessagesMapper.MapNoInputAndRedirectToSkill(
session.TurnState.TransId ?? session.LastTransId ?? string.Empty,
session.TurnState.ListenRules)
session.TurnState.ListenRules,
"@be/idle")
.Select(map => new WebSocketReply
{
Text = map.Text,
@@ -433,9 +434,10 @@ public sealed class WebSocketTurnFinalizationService(
ResetBufferedAudio(session);
turnState.SawListen = false;
turnState.SawContext = false;
return ResponsePlanToSocketMessagesMapper.MapNoInput(
return ResponsePlanToSocketMessagesMapper.MapNoInputAndRedirectToSkill(
turnState.TransId ?? session.LastTransId ?? string.Empty,
turnState.ListenRules)
turnState.ListenRules,
"@be/idle")
.Select(map => new WebSocketReply
{
Text = map.Text,