Fix personal report yes/no and weather hi/low handling

This commit is contained in:
Jacob Dubin
2026-05-17 20:20:48 -05:00
parent f2826253d5
commit af76cbaee2
5 changed files with 87 additions and 28 deletions

View File

@@ -942,13 +942,6 @@ public sealed class JiboInteractionService(
var name = personalMemoryStore.GetName(personScope);
if (string.IsNullOrWhiteSpace(name)) name = personalMemoryStore.GetName(ResolveTenantScope(turn));
if (string.IsNullOrWhiteSpace(name) &&
presence is not null &&
!string.IsNullOrWhiteSpace(presence.PrimaryPersonId) &&
presence.LoopUserFirstNames.TryGetValue(presence.PrimaryPersonId, out var firstName) &&
!string.IsNullOrWhiteSpace(firstName))
name = ToDisplayName(firstName);
name = ToDisplayName(name ?? string.Empty);
return string.IsNullOrWhiteSpace(name)

View File

@@ -103,6 +103,7 @@ internal static class PersonalReportOrchestrator
return new JiboInteractionDecision(
"personal_report_opt_in",
reply,
SkillPayload: BuildYesNoPromptPayload(),
ContextUpdates: contextUpdates);
}
@@ -119,6 +120,7 @@ internal static class PersonalReportOrchestrator
return new JiboInteractionDecision(
"personal_report_verify_user",
$"I think this is {knownName}. Is that right?",
SkillPayload: BuildYesNoPromptPayload(),
ContextUpdates: BuildContextUpdates(
AwaitingIdentityConfirmationState,
0,
@@ -147,6 +149,7 @@ internal static class PersonalReportOrchestrator
return new JiboInteractionDecision(
"personal_report_opt_in",
$"{inlineToggleSummary} Would you like your personal report now?",
SkillPayload: BuildYesNoPromptPayload(),
ContextUpdates: BuildContextUpdates(
AwaitingOptInState,
0,
@@ -425,6 +428,14 @@ internal static class PersonalReportOrchestrator
};
}
private static IDictionary<string, object?> BuildYesNoPromptPayload()
{
return new Dictionary<string, object?>(StringComparer.OrdinalIgnoreCase)
{
["listen_contexts"] = new[] { "shared/yes_no" }
};
}
private static bool IsAffirmativeReply(string loweredTranscript)
{
return ContainsAnyPhrase(loweredTranscript, AffirmativePhrases);

View File

@@ -163,13 +163,11 @@ public sealed class OpenWeatherReportProvider(
?? TryReadInt(selectedDayTemp, "night")
?? TryReadInt(selectedDayTemp, "morn")
?? TryReadInt(selectedDayTemp, "eve");
var high = TryReadInt(selectedDayTemp, "max");
var low = TryReadInt(selectedDayTemp, "min");
if (temperature is not null)
{
high = high is null ? temperature : Math.Max(high.Value, temperature.Value);
low = low is null ? temperature : Math.Min(low.Value, temperature.Value);
}
var currentDayHighLow = forecastDayOffset <= 0
? await TryResolveCurrentDayHighLowFromForecastAsync(location, useCelsius, cancellationToken)
: null;
var high = currentDayHighLow?.High ?? TryReadInt(selectedDayTemp, "max");
var low = currentDayHighLow?.Low ?? TryReadInt(selectedDayTemp, "min");
if (temperature is null && high is null && low is null) return null;
@@ -220,13 +218,9 @@ public sealed class OpenWeatherReportProvider(
var summary = TryReadWeatherSummary(root);
var condition = TryReadWeatherCondition(root);
var temperature = TryReadInt(main, "temp");
var high = TryReadInt(main, "temp_max");
var low = TryReadInt(main, "temp_min");
if (temperature is not null)
{
high = high is null ? temperature : Math.Max(high.Value, temperature.Value);
low = low is null ? temperature : Math.Min(low.Value, temperature.Value);
}
var currentDayHighLow = await TryResolveCurrentDayHighLowFromForecastAsync(location, useCelsius, cancellationToken);
var high = currentDayHighLow?.High ?? TryReadInt(main, "temp_max");
var low = currentDayHighLow?.Low ?? TryReadInt(main, "temp_min");
if (temperature is null && high is null && low is null) return null;
@@ -515,4 +509,4 @@ public sealed class OpenWeatherReportProvider(
int? LowTemperature,
string? Summary,
string? Condition);
}
}