Skip to content

Commit 3868dac

Browse files
committed
RE1-T115 PR#370 fixes
1 parent fb3ac67 commit 3868dac

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

Web/Resgrid.Web.Services/Twilio/TwilioVoiceResponseService.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,14 @@ public System.Threading.Tasks.Task PreWarmPromptAsync(string text, string voice
188188
{
189189
ArgumentException.ThrowIfNullOrWhiteSpace(text);
190190

191-
// Start the generation task (or return the existing one) without
191+
var chunks = ChunkText(text).ToList();
192+
if (chunks.Count != 1)
193+
throw new ArgumentException($"PreWarmPromptAsync does not support multi-chunk input (got {chunks.Count} chunks). Use AppendPromptAsync for multi-chunk text.", nameof(text));
194+
192195
// Start the generation task (or return the existing one) without
193196
// necessarily awaiting it. The TTS microservice's internal cache
194197
// persists across requests, so a subsequent call will find the URL.
195-
GetOrCreatePromptUrlAsync(text, voice, CancellationToken.None)
198+
GetOrCreatePromptUrlAsync(chunks[0], voice, CancellationToken.None)
196199
.ContinueWith(t =>
197200
{
198201
if (t.IsFaulted && t.Exception != null)
@@ -205,7 +208,11 @@ public async System.Threading.Tasks.Task<Uri> GetPromptUrlAsync(string text, str
205208
{
206209
ArgumentException.ThrowIfNullOrWhiteSpace(text);
207210

208-
return await GetOrCreatePromptUrlAsync(text, voice, cancellationToken);
211+
var chunks = ChunkText(text).ToList();
212+
if (chunks.Count != 1)
213+
throw new ArgumentException($"GetPromptUrlAsync does not support multi-chunk input (got {chunks.Count} chunks). Use AppendPromptAsync for multi-chunk text.", nameof(text));
214+
215+
return await GetOrCreatePromptUrlAsync(chunks[0], voice, cancellationToken);
209216
}
210217

211218
private async Task<Uri> GetOrCreatePromptUrlAsync(string chunk, string voice, CancellationToken cancellationToken)

Web/Resgrid.Web.Tts/Services/TtsService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ public async Task WarmPromptsAsync(CancellationToken cancellationToken)
5858
.Distinct(StringComparer.Ordinal)
5959
.ToList();
6060

61+
var defaultVoiceWarmed = false;
62+
6163
foreach (var prompt in prompts)
6264
{
6365
try
6466
{
6567
await GenerateInternalAsync(new NormalizedTtsRequest(prompt, _options.DefaultVoice, _options.DefaultSpeed), cancellationToken);
68+
defaultVoiceWarmed = true;
6669
}
6770
catch (ArgumentException ex)
6871
{
@@ -97,7 +100,7 @@ public async Task WarmPromptsAsync(CancellationToken cancellationToken)
97100
// Skip the default voice — its model was already covered by the
98101
// static prompts above provided at least one prompt is configured.
99102
var profile = _audioProcessingService.GetEffectiveSynthesisProfile(voice, _options.DefaultSpeed);
100-
if (string.Equals(profile.Voice, defaultProfile.Voice, StringComparison.OrdinalIgnoreCase))
103+
if (defaultVoiceWarmed && string.Equals(profile.Voice, defaultProfile.Voice, StringComparison.OrdinalIgnoreCase))
101104
{
102105
continue;
103106
}

Web/Resgrid.Web/Areas/User/Models/Calls/NewCallView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class NewCallView : BaseUserModel
4141
public string PrimaryContact { get; set; }
4242
public List<string> AdditionalContacts { get; set; }
4343
public List<SelectListItem> DestinationPois { get; set; }
44+
[System.ComponentModel.DataAnnotations.DisplayFormat(DataFormatString = "{0:MM/dd/yyyy HH:mm}", ApplyFormatInEditMode = true)]
4445
public DateTime? ScheduleDispatchDate { get; set; }
4546

4647
public NewCallView()

Web/Resgrid.Web/Areas/User/Models/Calls/UpdateCallView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class UpdateCallView: BaseUserModel
3737
public int CallTemplateId { get; set; }
3838
public string NewCallFormData { get; set; }
3939
public List<SelectListItem> DestinationPois { get; set; }
40-
[System.ComponentModel.DataAnnotations.DisplayFormat(DataFormatString = "{0:MM/dd/yyyy HH:mm}")]
40+
[System.ComponentModel.DataAnnotations.DisplayFormat(DataFormatString = "{0:MM/dd/yyyy HH:mm}", ApplyFormatInEditMode = true)]
4141
public DateTime? ScheduleDispatchDate { get; set; }
4242

4343
public UpdateCallView()

0 commit comments

Comments
 (0)