Added support for a minimal JSON output schema

This commit is contained in:
2026-04-28 14:39:00 -05:00
parent a3ca6665a9
commit 9cca88280f
16 changed files with 658 additions and 44 deletions

View File

@@ -57,6 +57,41 @@ func FromMerged(cfg config.Config, merged model.MergedTranscript) schema.Transcr
}
}
// MinimalFromMerged converts the internal merged transcript model into the
// compact public serialized output contract.
func MinimalFromMerged(cfg config.Config, merged model.MergedTranscript) schema.MinimalTranscript {
segments := make([]schema.MinimalSegment, len(merged.Segments))
for index, segment := range merged.Segments {
segments[index] = schema.MinimalSegment{
ID: segment.ID,
Start: segment.Start,
End: segment.End,
Speaker: segment.Speaker,
Text: segment.Text,
}
}
return schema.MinimalTranscript{
Metadata: schema.MinimalMetadata{
Application: ApplicationName,
Version: buildinfo.Version,
OutputSchema: config.OutputSchemaMinimal,
},
Segments: segments,
}
}
// SelectedFromMerged converts the internal merged transcript model into the
// runtime-selected public output contract.
func SelectedFromMerged(cfg config.Config, merged model.MergedTranscript) any {
switch cfg.OutputSchema {
case config.OutputSchemaMinimal:
return MinimalFromMerged(cfg, merged)
default:
return FromMerged(cfg, merged)
}
}
func copyIntPtr(value *int) *int {
if value == nil {
return nil