mirror of
https://github.com/rishikanthc/Scriberr.git
synced 2026-07-01 08:15:46 +00:00
Add option to include speaker labels in summary prompts when diarization is available. When enabled, transcripts are formatted as: [SPEAKER_NAME] Text here... The prompt also includes a hint to the LLM that speaker labels are present, helping it produce summaries that attribute statements to specific speakers. Changes: - Add IncludeSpeakerInfo field to SummaryTemplate model - Add toggle UI in summary template dialog - Format transcript with speaker labels when generating summary - Update prompt prefix to indicate speaker labels are present Closes #353 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
57 lines
2.1 KiB
Go
57 lines
2.1 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// SummaryTemplate represents a saved summarization prompt/template
|
|
type SummaryTemplate struct {
|
|
ID string `json:"id" gorm:"primaryKey;type:varchar(36)"`
|
|
Name string `json:"name" gorm:"type:varchar(255);not null"`
|
|
Description *string `json:"description,omitempty" gorm:"type:text"`
|
|
Model string `json:"model" gorm:"type:varchar(255);not null;default:''"`
|
|
Prompt string `json:"prompt" gorm:"type:text;not null"`
|
|
IncludeSpeakerInfo bool `json:"include_speaker_info" gorm:"default:false"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
}
|
|
|
|
func (st *SummaryTemplate) BeforeCreate(tx *gorm.DB) error {
|
|
if st.ID == "" {
|
|
st.ID = uuid.New().String()
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SummarySetting stores global settings for summarization (single row)
|
|
type SummarySetting struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
DefaultModel string `json:"default_model" gorm:"type:varchar(255);not null;default:''"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
}
|
|
|
|
// Summary stores a generated summary linked to a transcription
|
|
type Summary struct {
|
|
ID string `json:"id" gorm:"primaryKey;type:varchar(36)"`
|
|
TranscriptionID string `json:"transcription_id" gorm:"type:varchar(36);index;not null"`
|
|
TemplateID *string `json:"template_id,omitempty" gorm:"type:varchar(36)"`
|
|
Model string `json:"model" gorm:"type:varchar(255);not null"`
|
|
Content string `json:"content" gorm:"type:text;not null"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
|
|
// Relationships
|
|
Transcription TranscriptionJob `json:"transcription,omitempty" gorm:"foreignKey:TranscriptionID;constraint:OnDelete:CASCADE"`
|
|
}
|
|
|
|
// BeforeCreate ensures Summary has a UUID primary key
|
|
func (s *Summary) BeforeCreate(tx *gorm.DB) error {
|
|
if s.ID == "" {
|
|
s.ID = uuid.New().String()
|
|
}
|
|
return nil
|
|
}
|