Upload a recording (audio, or video with the camera off), get a private Swedish transcript, and chat about it. - ADR-033: RLS-scoped private transcript store; ffprobe/ffmpeg intake; gateway transcription (iguana kb-whisper, berget fallback); in-process single-replica worker; chat over the transcript (local models only). - ADR-034: optional two-engine mode (pianissimo + kb-whisper) reconciled by a LOCAL model; off unless TAPIR_RECONCILE_BASE_MODEL is set. - ADR-035: real progress (phases, running/quiet/lost), phase logging, every judged spot stored, merged segments. - Hardening from four adversarial reviews: errors logged and stored as kinds never text; per-engine deadlines; converted-length check; bounded queue; client hang-ups are not errors; strict local-alias check. - Dockerfile: static ffmpeg/ffprobe 7.0.2 pinned by sha256 (#34). Built and inspected by hand; CI does not build the image on a PR, so its first CI build is this merge. Uploads stay OFF until TAPIR_UPLOADS_ENABLED is set in the deployment. Closes #33, #34, #42, #43, #44. Co-authored-by: Mathias <mthbqv@gmail.com>
This commit was merged in pull request #39.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package transcribe_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.d-ma.be/mathias/tapir/internal/adapters/transcribe"
|
||||
)
|
||||
|
||||
// TestGateway_LiveGateway is an opt-in check against the REAL gateway, because
|
||||
// the httptest fake above can only prove what we think the gateway accepts. It
|
||||
// is skipped unless TAPIR_LIVE_WAV names a 16 kHz mono WAV and the gateway
|
||||
// coordinates are set:
|
||||
//
|
||||
// TAPIR_LIVE_WAV=/path/a.wav TAPIR_LIVE_GATEWAY_URL=http://koala:30401/v1 \
|
||||
// TAPIR_LIVE_MODEL=iguana/kb-whisper op run --env-file ~/.op-env -- \
|
||||
// go test ./internal/adapters/transcribe -run LiveGateway -v
|
||||
//
|
||||
// Use SYNTHETIC audio only: this repo is public and the gateway may be a cloud
|
||||
// endpoint (#33).
|
||||
func TestGateway_LiveGateway(t *testing.T) {
|
||||
wav := os.Getenv("TAPIR_LIVE_WAV")
|
||||
url := os.Getenv("TAPIR_LIVE_GATEWAY_URL")
|
||||
if wav == "" || url == "" {
|
||||
t.Skip("set TAPIR_LIVE_WAV and TAPIR_LIVE_GATEWAY_URL to run against the real gateway")
|
||||
}
|
||||
model := os.Getenv("TAPIR_LIVE_MODEL")
|
||||
if model == "" {
|
||||
model = "iguana/kb-whisper"
|
||||
}
|
||||
key := os.Getenv("LITELLM_MASTER_KEY")
|
||||
require.NotEmpty(t, key, "LITELLM_MASTER_KEY must be set (via op run)")
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute)
|
||||
defer cancel()
|
||||
got, err := transcribe.NewGateway(url, key, model, &http.Client{}).Transcribe(ctx, wav)
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.NotEmpty(t, got.Text)
|
||||
assert.NotEmpty(t, got.Segments)
|
||||
assert.Equal(t, model, got.Endpoint)
|
||||
t.Logf("endpoint=%s audio_s=%.1f segments=%d chars=%d", got.Endpoint, got.AudioSeconds, len(got.Segments), len(got.Text))
|
||||
}
|
||||
Reference in New Issue
Block a user