From e3288d0654ae99dfab3285e169ce3f66af653142 Mon Sep 17 00:00:00 2001 From: Mathias Date: Sun, 4 Oct 2026 22:41:42 +0200 Subject: [PATCH] feat(web): the language is named on the recording's page in every state; the feature says what Other really does (#61) The label moves from the done fragment to the page header, so queued, transcribing and failed recordings show it too. The scenario no longer implies a general engine exists. Found by the PR #62 review. Co-Authored-By: Claude Sonnet 5.5 --- docs/use-cases/audio_upload.feature | 3 +- internal/web/uploads.templ | 2 +- internal/web/uploads_language_handler_test.go | 34 ++++++------ internal/web/uploads_templ.go | 52 +++++++++---------- 4 files changed, 47 insertions(+), 44 deletions(-) diff --git a/docs/use-cases/audio_upload.feature b/docs/use-cases/audio_upload.feature index 76cc955..7db3219 100644 --- a/docs/use-cases/audio_upload.feature +++ b/docs/use-cases/audio_upload.feature @@ -289,4 +289,5 @@ Feature: Upload an audio recording, get a private Swedish transcript, discuss it Scenario: A recording in another language never reaches the Swedish-only engine When I choose Other for a recording - Then the language is left for the engine to detect and no Swedish-only engine or reconcile is used + Then the language is left for the engine to detect and the Swedish-only base engine and the reconcile are not used + And the engine that does run is the configured one, which is not tuned for other languages diff --git a/internal/web/uploads.templ b/internal/web/uploads.templ index d85d1c5..60f9e4b 100644 --- a/internal/web/uploads.templ +++ b/internal/web/uploads.templ @@ -57,6 +57,7 @@ templ UploadPage(u domain.UploadedTranscript, chatEnabled bool, now time.Time) { @Layout("Tapir — " + u.Title) { @@ -74,7 +75,6 @@ templ uploadStatus(u domain.UploadedTranscript, chatEnabled bool, now time.Time) Transcribed { uploads.FormatDuration(time.Duration(u.AudioSeconds * float64(time.Second))) } of audio by { u.Endpoint }.

-

Language: { languageLabel(u.Language) }

if provider, cloud := cloudProvider(u.Endpoint); cloud {

This recording's audio left the homelab: it was transcribed by a cloud service ({ provider }) diff --git a/internal/web/uploads_language_handler_test.go b/internal/web/uploads_language_handler_test.go index c96bc33..73ea735 100644 --- a/internal/web/uploads_language_handler_test.go +++ b/internal/web/uploads_language_handler_test.go @@ -127,23 +127,25 @@ func TestUploadPage_TheFormOffersSwedishPreselectedAndOtherBeforeTheFilePart(t * assert.Contains(t, b, `

Language: ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(languageLabel(u.Language)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/uploads.templ`, Line: 60, Col: 57} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -230,7 +243,7 @@ func UploadPage(u domain.UploadedTranscript, chatEnabled bool, now time.Time) te if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "

All recordings

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "

All recordings

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -262,14 +275,14 @@ func uploadStatus(u domain.UploadedTranscript, chatEnabled bool, now time.Time) }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var12 := templ.GetChildren(ctx) - if templ_7745c5c3_Var12 == nil { - templ_7745c5c3_Var12 = templ.NopComponent + templ_7745c5c3_Var13 := templ.GetChildren(ctx) + if templ_7745c5c3_Var13 == nil { + templ_7745c5c3_Var13 = templ.NopComponent } ctx = templ.ClearChildren(ctx) switch u.Status { case domain.UploadDone: - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -277,46 +290,33 @@ func uploadStatus(u domain.UploadedTranscript, chatEnabled bool, now time.Time) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "

Transcribed ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(uploads.FormatDuration(time.Duration(u.AudioSeconds * float64(time.Second)))) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/uploads.templ`, Line: 74, Col: 95} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " of audio by ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "

Transcribed ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var14 string - templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(u.Endpoint) + templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(uploads.FormatDuration(time.Duration(u.AudioSeconds * float64(time.Second)))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/uploads.templ`, Line: 75, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/uploads.templ`, Line: 75, Col: 95} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, ".

Language: ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, " of audio by ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(languageLabel(u.Language)) + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(u.Endpoint) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/uploads.templ`, Line: 77, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/uploads.templ`, Line: 76, Col: 48} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, ".

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }