Public Access
Add meeting assistant speech and summary automation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using MeetingAssistant.Recording;
|
||||
using MeetingAssistant.Speakers;
|
||||
using MeetingAssistant.Transcription;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.AspNetCore.TestHost;
|
||||
@@ -68,6 +69,36 @@ public sealed class AsrDiagnosticEndpointTests
|
||||
Assert.StartsWith("diarized:endpoint-bytes:", segment.Text, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SpeakerIdentityMergeDiagnosticEndpointUsesRecentDaysParameter()
|
||||
{
|
||||
var mergeService = new CapturingSpeakerIdentityMergeService();
|
||||
await using var factory = new WebApplicationFactory<Program>()
|
||||
.WithWebHostBuilder(builder =>
|
||||
{
|
||||
builder.ConfigureAppConfiguration((_, configuration) =>
|
||||
{
|
||||
configuration.AddInMemoryCollection(new Dictionary<string, string?>
|
||||
{
|
||||
["MeetingAssistant:FunAsr:Backend:Enabled"] = "false"
|
||||
});
|
||||
});
|
||||
builder.ConfigureTestServices(services =>
|
||||
{
|
||||
services.RemoveAll<ISpeakerIdentityMergeService>();
|
||||
services.AddSingleton<ISpeakerIdentityMergeService>(mergeService);
|
||||
});
|
||||
});
|
||||
using var client = factory.CreateClient();
|
||||
|
||||
using var response = await client.PostAsJsonAsync(
|
||||
"/diagnostics/speaker-identities/merge",
|
||||
new { recentDays = 7 });
|
||||
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.Equal(TimeSpan.FromDays(7), mergeService.RecentIdentityAge);
|
||||
}
|
||||
|
||||
private static WebApplicationFactory<Program> CreateFactory<TProvider>()
|
||||
where TProvider : class, IStreamingTranscriptionProvider
|
||||
{
|
||||
@@ -101,6 +132,7 @@ public sealed class AsrDiagnosticEndpointTests
|
||||
{
|
||||
public async IAsyncEnumerable<TranscriptionSegment> TranscribeAsync(
|
||||
IAsyncEnumerable<AudioChunk> audio,
|
||||
SpeechRecognitionPipelineOptions options,
|
||||
[System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
var bytes = 0;
|
||||
@@ -117,6 +149,7 @@ public sealed class AsrDiagnosticEndpointTests
|
||||
{
|
||||
public async IAsyncEnumerable<TranscriptionSegment> TranscribeAsync(
|
||||
IAsyncEnumerable<AudioChunk> audio,
|
||||
SpeechRecognitionPipelineOptions options,
|
||||
[System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
await Task.Yield();
|
||||
@@ -171,4 +204,18 @@ public sealed class AsrDiagnosticEndpointTests
|
||||
private sealed record AsrDiagnosticResponse(string Path, IReadOnlyList<AsrDiagnosticSegment> Segments);
|
||||
|
||||
private sealed record AsrDiagnosticSegment(string Speaker, string Text);
|
||||
|
||||
private sealed class CapturingSpeakerIdentityMergeService : ISpeakerIdentityMergeService
|
||||
{
|
||||
public TimeSpan? RecentIdentityAge { get; private set; }
|
||||
|
||||
public Task<SpeakerIdentityMergeResult> MergeRecentIdentitiesAsync(
|
||||
TimeSpan? recentIdentityAge,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
RecentIdentityAge = recentIdentityAge;
|
||||
return Task.FromResult(new SpeakerIdentityMergeResult(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user