From 4553ee02c7434506f8226cf0b24de18e5ede0fd1 Mon Sep 17 00:00:00 2001 From: eureka928 Date: Fri, 30 Jan 2026 10:09:35 +0100 Subject: [PATCH] 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 --- backend/backend.proto | 1 + core/backend/transcript.go | 11 ++++++----- core/schema/transcription.go | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/backend/backend.proto b/backend/backend.proto index 50b239a77..2ba04c883 100644 --- a/backend/backend.proto +++ b/backend/backend.proto @@ -299,6 +299,7 @@ message TranscriptSegment { int64 end = 3; string text = 4; repeated int32 tokens = 5; + string speaker = 6; } message GenerateImageRequest { diff --git a/core/backend/transcript.go b/core/backend/transcript.go index 62b04874c..4c721e986 100644 --- a/core/backend/transcript.go +++ b/core/backend/transcript.go @@ -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 diff --git a/core/schema/transcription.go b/core/schema/transcription.go index d843a9d98..dc22abe85 100644 --- a/core/schema/transcription.go +++ b/core/schema/transcription.go @@ -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 {