version 18 testing video session - full regression fixes
This commit is contained in:
@@ -425,6 +425,8 @@ public sealed class JiboInteractionService(
|
||||
if (MatchesAny(
|
||||
loweredTranscript,
|
||||
"photo gallery",
|
||||
"photogal",
|
||||
"photo gal",
|
||||
"open the gallery",
|
||||
"open photo gallery",
|
||||
"show my photos",
|
||||
@@ -1172,9 +1174,10 @@ public sealed class JiboInteractionService(
|
||||
|
||||
private static bool IsCancelRequest(string? clientIntent, string loweredTranscript)
|
||||
{
|
||||
var normalizedTranscript = NormalizeCommandPhrase(loweredTranscript);
|
||||
return string.Equals(clientIntent, "cancel", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(clientIntent, "stop", StringComparison.OrdinalIgnoreCase) ||
|
||||
loweredTranscript is "cancel" or "stop" or "never mind" or "nevermind";
|
||||
normalizedTranscript is "cancel" or "stop" or "never mind" or "nevermind";
|
||||
}
|
||||
|
||||
private static bool IsGlobalStopRequest(
|
||||
@@ -1188,8 +1191,9 @@ public sealed class JiboInteractionService(
|
||||
return true;
|
||||
}
|
||||
|
||||
return loweredTranscript is "stop" or "stop it" or "stop that" or "stop talking" or "be quiet" or "never mind" or "nevermind" or "forget it" ||
|
||||
MatchesAny(loweredTranscript, "that s enough", "that's enough", "that will do", "that ll do", "that'll do", "cut it out", "cut that out");
|
||||
var normalizedTranscript = NormalizeCommandPhrase(loweredTranscript);
|
||||
return normalizedTranscript is "stop" or "stop it" or "stop that" or "stop talking" or "be quiet" or "never mind" or "nevermind" or "forget it" ||
|
||||
MatchesAny(normalizedTranscript, "that s enough", "that will do", "that ll do", "cut it out", "cut that out");
|
||||
}
|
||||
|
||||
private static bool IsVolumeQueryRequest(string loweredTranscript)
|
||||
@@ -1287,10 +1291,26 @@ public sealed class JiboInteractionService(
|
||||
return "1";
|
||||
}
|
||||
|
||||
var match = VolumeLevelPattern.Match(loweredTranscript);
|
||||
var normalizedTranscript = NormalizeCommandPhrase(loweredTranscript);
|
||||
var homophoneMatch = VolumeToValueHomophonePattern.Match(normalizedTranscript);
|
||||
if (homophoneMatch.Success &&
|
||||
TryNormalizeVolumeLevel(homophoneMatch.Groups["value"].Value) is { } homophoneLevel)
|
||||
{
|
||||
return homophoneLevel;
|
||||
}
|
||||
|
||||
var match = VolumeLevelPattern.Match(normalizedTranscript);
|
||||
return !match.Success ? null : TryNormalizeVolumeLevel(match.Groups["value"].Value);
|
||||
}
|
||||
|
||||
private static string NormalizeCommandPhrase(string value)
|
||||
{
|
||||
return CommandWhitespacePattern.Replace(
|
||||
CommandPhrasePattern.Replace(value.Trim().ToLowerInvariant(), " "),
|
||||
" ")
|
||||
.Trim();
|
||||
}
|
||||
|
||||
private static string? TryNormalizeVolumeLevel(string token)
|
||||
{
|
||||
if (string.Equals(token, "null", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -1489,6 +1509,18 @@ public sealed class JiboInteractionService(
|
||||
@"\b(?:volume|loudness)\s*(?:to|at|level|is)?\s*(?<value>10|\d|one|two|three|four|five|six|seven|eight|nine|ten)\b|\b(?:set|change|make|turn)\s+(?:the\s+|your\s+)?(?:volume|loudness)\s*(?:to|at)?\s*(?<value>10|\d|one|two|three|four|five|six|seven|eight|nine|ten)\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex VolumeToValueHomophonePattern = new(
|
||||
@"\b(?:volume|loudness)\s+(?:2|two|to)\s+(?<value>10|\d|one|two|three|four|five|six|seven|eight|nine|ten)\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex CommandPhrasePattern = new(
|
||||
@"[^\w\s]",
|
||||
RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex CommandWhitespacePattern = new(
|
||||
@"\s+",
|
||||
RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private static readonly (string Phrase, string Station)[] RadioGenreAliases =
|
||||
[
|
||||
("country music", "Country"),
|
||||
|
||||
@@ -87,6 +87,7 @@ public sealed partial class WebSocketTurnFinalizationService(
|
||||
turnState.AwaitingTurnCompletion = false;
|
||||
turnState.IgnoreAdditionalAudioUntilUtc = DateTimeOffset.UtcNow.Add(WebSocketTurnState.DefaultLateAudioIgnoreWindow);
|
||||
ResetBufferedAudio(session);
|
||||
turnState.SawListen = false;
|
||||
turnState.SawContext = false;
|
||||
return [];
|
||||
}
|
||||
@@ -550,9 +551,24 @@ public sealed partial class WebSocketTurnFinalizationService(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (HasCloudHandledLocalPromptOpen(session.TurnState))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var skillId = TryReadContextSkillId(text);
|
||||
return string.Equals(skillId, "@be/gallery", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(skillId, "@be/create", StringComparison.OrdinalIgnoreCase);
|
||||
string.Equals(skillId, "@be/create", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(skillId, "@be/settings", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static bool HasCloudHandledLocalPromptOpen(WebSocketTurnState turnState)
|
||||
{
|
||||
return turnState is { AwaitingTurnCompletion: true, SawListen: true } &&
|
||||
turnState.ListenRules.Any(rule =>
|
||||
IsClockValueRule(rule) ||
|
||||
IsGalleryPreviewRule(rule) ||
|
||||
IsConstrainedYesNoRule(rule));
|
||||
}
|
||||
|
||||
private static string? ExtractDataPayload(string? text)
|
||||
@@ -781,6 +797,7 @@ public sealed partial class WebSocketTurnFinalizationService(
|
||||
private static bool IsLocalNoInputRule(string rule)
|
||||
{
|
||||
return string.Equals(rule, "clock/alarm_timer_okay", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(rule, "settings/volume_control", StringComparison.OrdinalIgnoreCase) ||
|
||||
IsClockValueRule(rule) ||
|
||||
IsGalleryPreviewRule(rule) ||
|
||||
IsConstrainedYesNoRule(rule);
|
||||
|
||||
Reference in New Issue
Block a user