package config import "strings" type llmTargetPatch struct { apiKey *string model *string baseURL *string timeoutSeconds *int maxRetries *int } type concurrencyPatch struct { totalLLM *int legacyTotalLLM *int proposalLLM *int validationLLM *int inheritProposal bool allowLegacyAlias bool } type chunkingPatch struct { targetSections *int maxSectionTokens *int minSectionTokens *int } type thresholdsPatch struct { glossary *float64 grammar *float64 homophones *float64 spokenWord *float64 } type normalizationPatch struct { maxSegmentGap *float64 ellipsisGap *float64 maxSegmentDuration *float64 maxSegmentTokens *int } type contextPatch struct { transcriptDescription *string } type diagnosticsPatch struct { workDir *string workDirRetention *string } func (c *Config) applyPrimaryLLMTargetPatch(patch llmTargetPatch) { if patch.apiKey != nil { c.PrimaryLLM.APIKey = *patch.apiKey } if patch.model != nil { c.PrimaryLLM.Model = *patch.model } if patch.baseURL != nil { c.PrimaryLLM.BaseURL = *patch.baseURL } if patch.timeoutSeconds != nil { c.PrimaryLLM.TimeoutSeconds = *patch.timeoutSeconds } if patch.maxRetries != nil { c.PrimaryLLM.MaxRetries = *patch.maxRetries } } func (c *Config) applyValidationLLMTargetPatch(patch llmTargetPatch) { if patch.apiKey != nil { c.ValidationLLM.APIKey = *patch.apiKey } if patch.model != nil { c.ValidationLLM.Model = *patch.model } if patch.baseURL != nil { c.ValidationLLM.BaseURL = *patch.baseURL } if patch.timeoutSeconds != nil { value := *patch.timeoutSeconds c.ValidationLLM.TimeoutSeconds = &value } if patch.maxRetries != nil { value := *patch.maxRetries c.ValidationLLM.MaxRetries = &value } } func (c *Config) applyConcurrencyPatch(patch concurrencyPatch) { totalSet := false if patch.totalLLM != nil { c.TotalLLMConcurrency = *patch.totalLLM totalSet = true } if patch.allowLegacyAlias && patch.legacyTotalLLM != nil && !totalSet { c.TotalLLMConcurrency = *patch.legacyTotalLLM totalSet = true } proposalSet := false if patch.proposalLLM != nil { c.ProposalLLMConcurrency = *patch.proposalLLM proposalSet = true } if patch.inheritProposal && totalSet && !proposalSet { c.ProposalLLMConcurrency = c.TotalLLMConcurrency } if patch.validationLLM != nil { value := *patch.validationLLM c.ValidationLLMConcurrency = &value } } func (c *Config) applyChunkingPatch(patch chunkingPatch) { if patch.targetSections != nil { value := *patch.targetSections c.TargetSections = &value } if patch.maxSectionTokens != nil { c.MaxSectionTokens = *patch.maxSectionTokens } if patch.minSectionTokens != nil { c.MinSectionTokens = *patch.minSectionTokens } } func (c *Config) applyThresholdsPatch(patch thresholdsPatch) { if patch.glossary != nil { c.Thresholds.Glossary = *patch.glossary } if patch.grammar != nil { c.Thresholds.Grammar = *patch.grammar } if patch.homophones != nil { c.Thresholds.Homophones = *patch.homophones } if patch.spokenWord != nil { c.Thresholds.SpokenWord = *patch.spokenWord } } func (c *Config) applyNormalizationPatch(patch normalizationPatch) { if patch.maxSegmentGap != nil { c.Normalization.MaxSegmentGap = *patch.maxSegmentGap } if patch.ellipsisGap != nil { c.Normalization.EllipsisGap = *patch.ellipsisGap } if patch.maxSegmentDuration != nil { c.Normalization.MaxSegmentDuration = *patch.maxSegmentDuration } if patch.maxSegmentTokens != nil { c.Normalization.MaxSegmentTokens = *patch.maxSegmentTokens } } func (c *Config) applyContextPatch(patch contextPatch) { if patch.transcriptDescription != nil { c.TranscriptDescription = strings.TrimSpace(*patch.transcriptDescription) } } func (c *Config) applyDiagnosticsPatch(patch diagnosticsPatch) { if patch.workDir != nil { c.WorkDir = *patch.workDir } if patch.workDirRetention != nil { c.WorkDirRetention = WorkDirRetention(*patch.workDirRetention) } }