feat(uploads): an auto-language job is planned without the engines it never runs (#61)
PlanFor(lang) on the Ensemble and a LanguagePlanner the worker prefers: the page lists the other engine (and the fallback if configured), not the base engine, the comparison and the decisions as coming. Found by the PR #62 review. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,14 +32,24 @@ func NewEnsemble(base, alt, fallback Backend, adj reconcile.Adjudicator, opts re
|
||||
return &Ensemble{base: base, alt: alt, fallback: fallback, adj: adj, opts: opts}
|
||||
}
|
||||
|
||||
// Plan implements uploads.Planner: the phases this ensemble reports, so the page can
|
||||
// show them before they run. The fallback is a phase only when one is configured.
|
||||
func (e *Ensemble) Plan() []progress.Planned {
|
||||
plan := []progress.Planned{
|
||||
{Key: "engine_a", Label: "Transcribing with " + e.base.Name()},
|
||||
{Key: "engine_b", Label: "Transcribing with " + e.alt.Name()},
|
||||
{Key: "compare", Label: "Comparing the two transcripts"},
|
||||
{Key: "decide", Label: "Deciding the differences"},
|
||||
// Plan implements uploads.Planner: the phases of a Swedish job, the two-engine one. The
|
||||
// fallback is a phase only when one is configured.
|
||||
func (e *Ensemble) Plan() []progress.Planned { return e.PlanFor(domain.LangSwedish) }
|
||||
|
||||
// PlanFor implements uploads.LanguagePlanner. A recording that is not Swedish never runs the
|
||||
// base engine, the comparison or the decisions (transcribeOther), so the page lists only
|
||||
// what can run: the other engine, then the fallback if one is configured.
|
||||
func (e *Ensemble) PlanFor(lang domain.Language) []progress.Planned {
|
||||
var plan []progress.Planned
|
||||
if lang == domain.LangSwedish || lang == "" {
|
||||
plan = []progress.Planned{
|
||||
{Key: "engine_a", Label: "Transcribing with " + e.base.Name()},
|
||||
{Key: "engine_b", Label: "Transcribing with " + e.alt.Name()},
|
||||
{Key: "compare", Label: "Comparing the two transcripts"},
|
||||
{Key: "decide", Label: "Deciding the differences"},
|
||||
}
|
||||
} else {
|
||||
plan = []progress.Planned{{Key: "engine_b", Label: "Transcribing with " + e.alt.Name()}}
|
||||
}
|
||||
if e.fallback != nil {
|
||||
plan = append(plan, progress.Planned{Key: "fallback", Label: "Cloud fallback (" + e.fallback.Name() + ")"})
|
||||
|
||||
Reference in New Issue
Block a user