feat: upload audio, get a private Swedish transcript, discuss it (#33, ADR-033) #39
@@ -62,7 +62,7 @@ func (g *Gateway) Transcribe(ctx context.Context, path string) (domain.Transcrip
|
||||
if err != nil {
|
||||
return domain.Transcription{}, fmt.Errorf("transcribe: open audio: %w", err)
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
info, err := f.Stat()
|
||||
if err != nil {
|
||||
return domain.Transcription{}, fmt.Errorf("transcribe: stat audio: %w", err)
|
||||
@@ -95,7 +95,7 @@ func (g *Gateway) Transcribe(ctx context.Context, path string) (domain.Transcrip
|
||||
if err != nil {
|
||||
return domain.Transcription{}, fmt.Errorf("transcribe: %s: %w", g.model, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||
snip, _ := io.ReadAll(io.LimitReader(resp.Body, 200))
|
||||
return domain.Transcription{}, &StatusError{Code: resp.StatusCode, Snippet: strings.TrimSpace(string(snip))}
|
||||
|
||||
Reference in New Issue
Block a user