Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions openshift/kustomize/services/auto-clipper/base/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,26 @@ spec:
name: azure-openai
key: AZURE_OPENAI_KEY

# Azure Video Indexer Configuration (optional - for speaker identification)
- name: Service__AzureVideoIndexerAccountId
valueFrom:
secretKeyRef:
name: azure-video-indexer
key: AZURE_VIDEO_INDEXER_ACCOUNT_ID
optional: true
- name: Service__AzureVideoIndexerApiKey
valueFrom:
secretKeyRef:
name: azure-video-indexer
key: AZURE_VIDEO_INDEXER_API_KEY
optional: true
- name: Service__AzureVideoIndexerLocation
valueFrom:
secretKeyRef:
name: azure-video-indexer
key: AZURE_VIDEO_INDEXER_LOCATION
optional: true

# Service Configuration
- name: Service__MaxFailLimit
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ secretGenerator:
- name: azure-openai
type: stringData
env: openai.env
- name: azure-video-indexer
type: stringData
env: video-indexer.env

patches:
- target:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ secretGenerator:
- name: azure-openai
type: stringData
env: openai.env
- name: azure-video-indexer
type: stringData
env: video-indexer.env

patches:
- target:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ secretGenerator:
- name: azure-openai
type: stringData
env: openai.env
- name: azure-video-indexer
type: stringData
env: video-indexer.env

patches:
- target:
Expand Down
21 changes: 15 additions & 6 deletions services/net/auto-clipper/AutoClipperManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,23 +635,32 @@ private static void CleanupTemporaryFiles(bool isSyncedToS3, params string[] fil

/// <summary>
/// Format the transcript to include newlines.
/// When speaker information is available (from Video Indexer), includes speaker prefix.
/// Azure Speech transcripts have no speaker info and will output plain text.
/// </summary>
/// <param name="transcript"></param>
/// <returns></returns>
/// <param name="segments">Transcript segments with optional speaker information.</param>
/// <returns>Formatted transcript string.</returns>
private static string BuildTranscriptDocument(IReadOnlyList<TimestampedTranscript> segments)
{
if (segments == null || segments.Count == 0) return string.Empty;

var sb = new StringBuilder();
var index = 1;
foreach (var segment in segments)
{
if (string.IsNullOrWhiteSpace(segment.Text)) continue;
// sb.AppendLine(index.ToString(CultureInfo.InvariantCulture));
// sb.AppendLine($"{FormatTimestamp(segment.Start)} --> {FormatTimestamp(segment.End)}");

// Add speaker prefix if available (Video Indexer provides this)
if (!string.IsNullOrWhiteSpace(segment.SpeakerName))
{
sb.Append($"{segment.SpeakerName}: ");
}
else if (segment.SpeakerId.HasValue)
{
sb.Append($"speaker{segment.SpeakerId}: ");
}

sb.AppendLine(segment.Text.Trim());
sb.AppendLine();
index++;
}

return sb.ToString().Trim();
Expand Down
8 changes: 8 additions & 0 deletions services/net/auto-clipper/AutoClipperService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ protected override IServiceCollection ConfigureServices(IServiceCollection servi
services.AddSingleton<IAzureSpeechTranscriptionService, AzureSpeechTranscriptionService>();
services.AddHttpClient<IClipSegmentationService, ClipSegmentationService>();

// Register Video Indexer client if configured
var videoIndexerAccountId = this.Configuration.GetSection("Service")["AzureVideoIndexerAccountId"];
var videoIndexerApiKey = this.Configuration.GetSection("Service")["AzureVideoIndexerApiKey"];
if (!string.IsNullOrWhiteSpace(videoIndexerAccountId) && !string.IsNullOrWhiteSpace(videoIndexerApiKey))
{
services.AddHttpClient<IAzureVideoIndexerClient, AzureVideoIndexerClient>();
}

// TODO: Figure out how to validate without resulting in aggregating the config values.
// services.AddOptions<AutoClipperOptions>()
// .Bind(this.Configuration.GetSection("Service"))
Expand Down
Loading
Loading