feat: upload audio, get a private Swedish transcript, discuss it (#33, ADR-033) #39
@@ -111,3 +111,62 @@ type Summary struct {
|
||||
FallbackUsed bool
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
// Segment is one timed span of a transcription. Times are seconds from the start
|
||||
// of the audio.
|
||||
type Segment struct {
|
||||
Start float64 `json:"start"`
|
||||
End float64 `json:"end"`
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
// Transcription is the result of transcribing user-supplied audio (ADR-033):
|
||||
// the full text, its timed segments, which backend served it, and how long the
|
||||
// audio was. Endpoint is recorded because the backends differ in timestamp
|
||||
// granularity — which one served a transcript is a quality fact.
|
||||
type Transcription struct {
|
||||
Text string
|
||||
Segments []Segment
|
||||
Endpoint string
|
||||
AudioSeconds float64
|
||||
}
|
||||
|
||||
// UploadStatus is the state of an uploaded-audio transcription job.
|
||||
type UploadStatus string
|
||||
|
||||
const (
|
||||
UploadQueued UploadStatus = "queued"
|
||||
UploadTranscribing UploadStatus = "transcribing"
|
||||
UploadDone UploadStatus = "done"
|
||||
UploadFailed UploadStatus = "failed"
|
||||
)
|
||||
|
||||
// UploadErrorKind is the typed reason an upload failed. It is deliberately NOT a
|
||||
// provider's error string: the whisper server's "failed to process audio" has had
|
||||
// at least five distinct causes, so nothing may branch on it (ADR-033).
|
||||
type UploadErrorKind string
|
||||
|
||||
const (
|
||||
// UploadErrInterrupted: the process restarted mid-job. The audio is not
|
||||
// retained, so the job cannot resume; the user re-uploads.
|
||||
UploadErrInterrupted UploadErrorKind = "interrupted"
|
||||
// UploadErrTranscriptionFailed: every configured transcription endpoint failed.
|
||||
UploadErrTranscriptionFailed UploadErrorKind = "transcription_failed"
|
||||
)
|
||||
|
||||
// UploadedTranscript is a user's PRIVATE transcript of audio they uploaded. It is
|
||||
// never stored in, or merged with, the shared public-caption Transcript (ADR-021).
|
||||
// Content and Segments are empty until Status is UploadDone.
|
||||
type UploadedTranscript struct {
|
||||
ID string
|
||||
UserID string
|
||||
Title string
|
||||
Status UploadStatus
|
||||
Content string
|
||||
Segments []Segment
|
||||
Endpoint string
|
||||
AudioSeconds float64
|
||||
ErrorKind UploadErrorKind
|
||||
CreatedAt time.Time
|
||||
FinishedAt time.Time // zero until the job reaches done or failed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user