mirror of
https://github.com/rishikanthc/Scriberr.git
synced 2026-07-01 08:15:46 +00:00
Use usermappings in chat
If the db contains usermappings for the session these are sent to the LLM instead of generic names.
This commit is contained in:
committed by
Rishikanth Chandrasekaran
parent
323e0faea2
commit
bde45ddb6a
@@ -467,12 +467,28 @@ func (h *Handler) SendChatMessage(c *gin.Context) {
|
||||
|
||||
var sb strings.Builder
|
||||
|
||||
// Get speaker mappings
|
||||
mappings, err := h.speakerMappingRepo.ListByJob(c.Request.Context(), session.TranscriptionID)
|
||||
speakerMap := make(map[string]string)
|
||||
if err == nil {
|
||||
for _, m := range mappings {
|
||||
speakerMap[m.OriginalSpeaker] = m.CustomName
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Failed to get speaker mappings for job %s: %v\n", session.TranscriptionID, err)
|
||||
}
|
||||
|
||||
for _, seg := range t.Segments {
|
||||
start := formatTime(seg.Start)
|
||||
end := formatTime(seg.End)
|
||||
|
||||
speakerName := seg.Speaker
|
||||
if customName, ok := speakerMap[speakerName]; ok {
|
||||
speakerName = customName
|
||||
}
|
||||
|
||||
fmt.Fprintf(&sb, "[%s] [%s - %s] %s\n",
|
||||
seg.Speaker,
|
||||
speakerName,
|
||||
start,
|
||||
end,
|
||||
strings.TrimSpace(seg.Text),
|
||||
|
||||
Reference in New Issue
Block a user