alarm fixes

This commit is contained in:
Jacob Dubin
2026-04-21 23:24:56 -05:00
parent c74da1955b
commit 1f4adc8292
10 changed files with 4771 additions and 1 deletions

View File

@@ -971,7 +971,7 @@ public sealed class JiboInteractionService(
private sealed record ClockAlarmValue(string Time, string AmPm); private sealed record ClockAlarmValue(string Time, string AmPm);
private static readonly Regex SplitAlarmPattern = new( private static readonly Regex SplitAlarmPattern = new(
@"\b(?<hour>\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?:[:\s](?<minute>\d{2}|[a-z\-]+(?:\s+[a-z\-]+)?))?\s*(?<ampm>a\.?m\.?|p\.?m\.?)?\b", @"\b(?<hour>\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?:[:\s-](?<minute>\d{2}|[a-z\-]+(?:\s+[a-z\-]+)?))?\s*(?<ampm>a\.?m\.?|p\.?m\.?)?\b",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
private static readonly Regex CompactAlarmPattern = new( private static readonly Regex CompactAlarmPattern = new(

View File

@@ -320,6 +320,22 @@ public sealed class JiboInteractionServiceTests
Assert.Equal("am", decision.SkillPayload["ampm"]); Assert.Equal("am", decision.SkillPayload["ampm"]);
} }
[Fact]
public async Task BuildDecisionAsync_SetAlarmForTenTwentyFiveWithHyphen_ParsesSplitTime()
{
var service = CreateService();
var decision = await service.BuildDecisionAsync(new TurnContext
{
RawTranscript = "set an alarm for 10-25",
NormalizedTranscript = "set an alarm for 10-25"
});
Assert.Equal("alarm_value", decision.IntentName);
Assert.Equal("10:25", decision.SkillPayload!["time"]);
Assert.Equal("am", decision.SkillPayload["ampm"]);
}
[Fact] [Fact]
public async Task BuildDecisionAsync_TimerValueFollowUp_ParsesBareDuration() public async Task BuildDecisionAsync_TimerValueFollowUp_ParsesBareDuration()
{ {

View File

@@ -503,6 +503,36 @@ public sealed class JiboWebSocketServiceTests
Assert.Equal("am", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("entities").GetProperty("ampm").GetString()); Assert.Equal("am", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("entities").GetProperty("ampm").GetString());
} }
[Fact]
public async Task ClientAsr_SetAlarmForTenTwentyFiveWithHyphen_ParsesAlarmTime()
{
await _service.HandleMessageAsync(new WebSocketMessageEnvelope
{
HostName = "neo-hub.jibo.com",
Path = "/listen",
Kind = "neo-hub-listen",
Token = "hub-clock-hyphen-alarm-token",
Text = """{"type":"LISTEN","transID":"trans-clock-hyphen-alarm","data":{"rules":["globals/global_commands_launch"]}}"""
});
var replies = await _service.HandleMessageAsync(new WebSocketMessageEnvelope
{
HostName = "neo-hub.jibo.com",
Path = "/listen",
Kind = "neo-hub-listen",
Token = "hub-clock-hyphen-alarm-token",
Text = """{"type":"CLIENT_ASR","transID":"trans-clock-hyphen-alarm","data":{"text":"set an alarm for 10-25"}}"""
});
Assert.Equal(4, replies.Count);
using var listenPayload = JsonDocument.Parse(replies[0].Text!);
Assert.Equal("start", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("intent").GetString());
Assert.Equal("alarm", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("entities").GetProperty("domain").GetString());
Assert.Equal("10:25", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("entities").GetProperty("time").GetString());
Assert.Equal("am", listenPayload.RootElement.GetProperty("data").GetProperty("nlu").GetProperty("entities").GetProperty("ampm").GetString());
}
[Fact] [Fact]
public async Task ClientAsr_TimerValueFollowUp_ParsesBareDurationIntoClockStartIntent() public async Task ClientAsr_TimerValueFollowUp_ParsesBareDurationIntoClockStartIntent()
{ {

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
{
"exception": "System.InvalidOperationException: whisper.cpp returned no transcript for the buffered audio turn.\n at Jibo.Cloud.Infrastructure.Audio.LocalWhisperCppBufferedAudioSttStrategy.TranscribeAsync(TurnContext turn, CancellationToken cancellationToken) in /home/jake-dubin/JiboExperiments/OpenJibo/src/Jibo.Cloud/dotnet/src/Jibo.Cloud.Infrastructure/Audio/LocalWhisperCppBufferedAudioSttStrategy.cs:line 58\n at Jibo.Cloud.Application.Services.WebSocketTurnFinalizationService.ResolveTranscriptAsync(TurnContext turn, CloudSession session, CancellationToken cancellationToken) in /home/jake-dubin/JiboExperiments/OpenJibo/src/Jibo.Cloud/dotnet/src/Jibo.Cloud.Application/Services/WebSocketTurnFinalizationService.cs:line 219",
"message": "Error during STT processing"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
{
"name": "neohubjibocom-neohublisten-tid52b6f46e3b6a11f191515cf821ea55ae",
"session": {
"hostName": "neo-hub.jibo.com",
"path": "/v1/listen",
"kind": "neo-hub-listen",
"token": "hub-usr_openjibo_owner-1776545569192"
},
"steps": [
{
"text": {
"type": "LISTEN",
"ts": 1776546327052,
"msgID": "mid-5303b5f6-3b6a-11f1-adc4-5cf821ea55ae",
"transID": "tid-52b6f46e-3b6a-11f1-9151-5cf821ea55ae",
"data": {
"lang": "en-US",
"hotphrase": true,
"rules": [
"launch",
"globals/global_commands_launch"
],
"mode": "CLIENT_ASR",
"asr": {
"hints": [],
"earlyEOS": [],
"encoding": "OGG_OPUS",
"sampleRate": 16000,
"sosTimeout": 7000,
"maxSpeechTimeout": 20000
}
}
},
"binary": null,
"expectedReplyTypes": [
"OPENJIBO_TURN_PENDING"
]
},
{
"text": {
"type": "CLIENT_ASR",
"ts": 1776546327052,
"msgID": "mid-5303bd76-3b6a-11f1-81d4-5cf821ea55ae",
"transID": "tid-52b6f46e-3b6a-11f1-9151-5cf821ea55ae",
"data": {
"text": "tell me about the news"
}
},
"binary": null,
"expectedReplyTypes": [
"LISTEN",
"EOS",
"SKILL_ACTION"
]
},
{
"text": {
"type": "CONTEXT",
"ts": 1776546327177,
"msgID": "mid-5316cf2e-3b6a-11f1-8aa7-5cf821ea55ae",
"transID": "tid-52b6f46e-3b6a-11f1-9151-5cf821ea55ae",
"data": {
"runtime": {
"character": {
"emotion": {
"name": "NEUTRAL",
"valence": 0.45,
"confidence": 0.2
},
"motivation": {
"social": 1,
"playful": 1
}
},
"perception": {
"speaker": null,
"peoplePresent": []
},
"location": {
"city": "Pleasant Hill",
"state": "Missouri",
"stateAbbr": "MO",
"country": "United States",
"countryCode": "US",
"lat": 38.8358494,
"lng": -94.1427229,
"iso": "2026-04-18T16:05:27.073-05:00"
},
"loop": {
"loopId": "5c0b221fdf9d450019c5e253",
"users": [
{
"firstName": "Erin",
"lastName": "Picone",
"phoneticName": "Erin",
"gender": "female",
"birthdate": 649209600000,
"id": "5c0b221fdf9d450019c5e255",
"accountId": "5c0b20547c46170019235759"
}
],
"jibo": {
"color": "WHITE",
"birthdate": 1544234645598,
"id": "5c0b221fdf9d450019c5e254"
},
"owner": "5c0b221fdf9d450019c5e255"
},
"dialog": {
"referent": null
}
},
"skill": {
"id": null
},
"general": {
"release": "1.9.2"
}
}
},
"binary": null,
"expectedReplyTypes": [
"OPENJIBO_CONTEXT_ACK"
]
}
]
}

View File

@@ -0,0 +1,174 @@
{
"name": "neohubjibocom-neohublisten-tida8165b823b9411f195545cf821ea55ae",
"session": {
"hostName": "neo-hub.jibo.com",
"path": "/v1/listen",
"kind": "neo-hub-listen",
"token": "hub-usr_openjibo_owner-1776563295273"
},
"steps": [
{
"text": {
"type": "LISTEN",
"ts": 1776564508900,
"msgID": "mid-a83d9076-3b94-11f1-978d-5cf821ea55ae",
"transID": "tid-a8165b82-3b94-11f1-9554-5cf821ea55ae",
"data": {
"lang": "en-US",
"hotphrase": true,
"rules": [
"launch",
"globals/global_commands_launch"
],
"mode": "",
"asr": {
"hints": [],
"earlyEOS": [],
"encoding": "OGG_OPUS",
"sampleRate": 16000,
"sosTimeout": 7000,
"maxSpeechTimeout": 20000
}
}
},
"binary": null,
"expectedReplyTypes": [
"LISTEN",
"EOS",
"SKILL_ACTION"
]
},
{
"text": null,
"binary": [
79,
103,
103,
83,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
62,
200,
6,
48,
0,
0,
0,
0,
146,
142,
146,
101,
1,
19,
79,
112,
117,
115,
72,
101,
97,
100,
1,
1,
0,
0,
128,
62,
0,
0,
0,
0,
0
],
"expectedReplyTypes": [
"OPENJIBO_AUDIO_RECEIVED"
]
},
{
"text": {
"type": "CONTEXT",
"ts": 1776564510009,
"msgID": "mid-a8e6d640-3b94-11f1-b2b0-5cf821ea55ae",
"transID": "tid-a8165b82-3b94-11f1-9554-5cf821ea55ae",
"data": {
"runtime": {
"character": {
"emotion": {
"name": "NEUTRAL",
"valence": 0.45,
"confidence": 0.2
},
"motivation": {
"social": 1,
"playful": 1
}
},
"perception": {
"speaker": null,
"peoplePresent": [
{
"id": "NOT_TRAINED",
"entityId": 1282,
"type": "fused",
"confidence": 0.25
}
]
},
"location": {
"city": "Pleasant Hill",
"state": "Missouri",
"stateAbbr": "MO",
"country": "United States",
"countryCode": "US",
"lat": 38.8358494,
"lng": -94.1427229,
"iso": "2026-04-18T21:08:29.921-05:00"
},
"loop": {
"loopId": "5c0b221fdf9d450019c5e253",
"users": [
{
"firstName": "Erin",
"lastName": "Picone",
"phoneticName": "Erin",
"gender": "female",
"birthdate": 649209600000,
"id": "5c0b221fdf9d450019c5e255",
"accountId": "5c0b20547c46170019235759"
}
],
"jibo": {
"color": "WHITE",
"birthdate": 1544234645598,
"id": "5c0b221fdf9d450019c5e254"
},
"owner": "5c0b221fdf9d450019c5e255"
},
"dialog": {
"referent": null
}
},
"skill": {
"id": null
},
"general": {
"release": "1.9.2"
}
}
},
"binary": null,
"expectedReplyTypes": [
"OPENJIBO_CONTEXT_ACK"
]
}
]
}

View File

@@ -0,0 +1,95 @@
{
"name": "neohubjibocom-neohublisten-tidd2b591403b6811f1a5735cf821ea55ae",
"session": {
"hostName": "neo-hub.jibo.com",
"path": "/v1/listen",
"kind": "neo-hub-listen",
"token": "hub-usr_openjibo_owner-1776545569192"
},
"steps": [
{
"text": {
"type": "LISTEN",
"ts": 1776545682509,
"msgID": "mid-d2d657ea-3b68-11f1-985b-5cf821ea55ae",
"transID": "tid-d2b59140-3b68-11f1-a573-5cf821ea55ae",
"data": {
"lang": "en-US",
"hotphrase": true,
"rules": [
"launch",
"globals/global_commands_launch"
],
"mode": "",
"asr": {
"hints": [],
"earlyEOS": [],
"encoding": "OGG_OPUS",
"sampleRate": 16000,
"sosTimeout": 7000,
"maxSpeechTimeout": 20000
}
}
},
"binary": null,
"expectedReplyTypes": [
"OPENJIBO_TURN_PENDING"
]
},
{
"text": null,
"binary": [
79,
103,
103,
83,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
94,
132,
99,
103,
0,
0,
0,
0,
234,
141,
12,
246,
1,
19,
79,
112,
117,
115,
72,
101,
97,
100,
1,
1,
0,
0,
128,
62,
0,
0,
0,
0,
0
],
"expectedReplyTypes": [
"OPENJIBO_AUDIO_RECEIVED"
]
}
]
}

File diff suppressed because it is too large Load Diff