mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-19 22:29:10 -04:00
fix(grpc): forward word-level timestamps in AudioTranscription wrapper (#10402)
The gRPC server wrapper in pkg/grpc/server.go reconstructs TranscriptSegment messages when relaying AudioTranscription results from backends. The Words field was not being copied, causing all word-level timestamps to be silently dropped regardless of backend support. This was introduced when PR #9621 added the TranscriptWord proto message and transcriptResultFromProto (server-side), but did not update the server-side gRPC relay to forward the new field. Fixes #9306 Signed-off-by: fqscfqj <fqscfqj@outlook.com>
This commit is contained in:
@@ -243,6 +243,14 @@ func (s *server) AudioTranscription(ctx context.Context, in *pb.TranscriptReques
|
||||
for _, t := range s.Tokens {
|
||||
tks = append(tks, int32(t))
|
||||
}
|
||||
words := make([]*pb.TranscriptWord, 0, len(s.Words))
|
||||
for _, w := range s.Words {
|
||||
words = append(words, &pb.TranscriptWord{
|
||||
Start: int64(w.Start),
|
||||
End: int64(w.End),
|
||||
Text: w.Text,
|
||||
})
|
||||
}
|
||||
tresult.Segments = append(tresult.Segments,
|
||||
&pb.TranscriptSegment{
|
||||
Text: s.Text,
|
||||
@@ -251,6 +259,7 @@ func (s *server) AudioTranscription(ctx context.Context, in *pb.TranscriptReques
|
||||
End: int64(s.End),
|
||||
Tokens: tks,
|
||||
Speaker: s.Speaker,
|
||||
Words: words,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user