Added support for a minimal JSON output schema
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user