feat(proto): add speaker field to TranscriptSegment for diarization

Add speaker field to the gRPC TranscriptSegment message and map it
through the Go schema, enabling backends to return speaker labels.

Signed-off-by: eureka928 <meobius123@gmail.com>
This commit is contained in:
eureka928
2026-01-30 10:09:35 +01:00
parent b7585ca738
commit 4553ee02c7
3 changed files with 13 additions and 10 deletions

View File

@@ -299,6 +299,7 @@ message TranscriptSegment {
int64 end = 3;
string text = 4;
repeated int32 tokens = 5;
string speaker = 6;
}
message GenerateImageRequest {

View File

@@ -49,11 +49,12 @@ func ModelTranscription(audio, language string, translate, diarize bool, prompt
}
tr.Segments = append(tr.Segments,
schema.TranscriptionSegment{
Text: s.Text,
Id: int(s.Id),
Start: time.Duration(s.Start),
End: time.Duration(s.End),
Tokens: tks,
Text: s.Text,
Id: int(s.Id),
Start: time.Duration(s.Start),
End: time.Duration(s.End),
Tokens: tks,
Speaker: s.Speaker,
})
}
return tr, err

View File

@@ -3,11 +3,12 @@ package schema
import "time"
type TranscriptionSegment struct {
Id int `json:"id"`
Start time.Duration `json:"start"`
End time.Duration `json:"end"`
Text string `json:"text"`
Tokens []int `json:"tokens"`
Id int `json:"id"`
Start time.Duration `json:"start"`
End time.Duration `json:"end"`
Text string `json:"text"`
Tokens []int `json:"tokens"`
Speaker string `json:"speaker,omitempty"`
}
type TranscriptionResult struct {