Keep transcript decoding and encoding on typed data
This commit is contained in:
@@ -118,7 +118,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
|
||||
return RunOutput{}, fmt.Errorf("runner module factory is required")
|
||||
}
|
||||
|
||||
working := cloneTranscript(input.Transcript)
|
||||
working := input.Transcript.Clone()
|
||||
results := make([]ModuleResult, 0, len(input.ModuleSpecs))
|
||||
sections, err := chunkWorkingTranscript(input.Config, working)
|
||||
if err != nil {
|
||||
@@ -939,25 +939,3 @@ func transcriptFromSection(section chunking.Section) *schema.Transcript {
|
||||
copy(segments, section.Segments)
|
||||
return &schema.Transcript{Segments: segments}
|
||||
}
|
||||
|
||||
func cloneTranscript(t *schema.Transcript) *schema.Transcript {
|
||||
if t == nil {
|
||||
return &schema.Transcript{}
|
||||
}
|
||||
segments := make([]schema.Segment, len(t.Segments))
|
||||
for i, s := range t.Segments {
|
||||
var categories []string
|
||||
if s.Categories != nil {
|
||||
categories = append([]string(nil), s.Categories...)
|
||||
}
|
||||
segments[i] = schema.Segment{
|
||||
ID: s.ID,
|
||||
Speaker: s.Speaker,
|
||||
Start: s.Start,
|
||||
End: s.End,
|
||||
Text: s.Text,
|
||||
Categories: categories,
|
||||
}
|
||||
}
|
||||
return &schema.Transcript{Segments: segments}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user