Some checks failed
CodeQL / Analyze (go) (push) Successful in 6m28s
Docker Image / build-docker (push) Failing after 13m26s
Lint and Testing / lint (push) Successful in 11m17s
Lint and Testing / test (push) Successful in 11m17s
Lint and Testing / golangci (push) Successful in 2m40s
29 lines
815 B
Go
29 lines
815 B
Go
package api
|
|
|
|
import "go-whisper-api/whisper"
|
|
|
|
// sprResultReady builds GET /spr/result/{taskID} body for completed tasks (SPR-compatible).
|
|
func sprResultReady(params TaskParams) map[string]any {
|
|
words := params.Words
|
|
if words == nil {
|
|
words = []whisper.Word{}
|
|
}
|
|
return map[string]any{
|
|
"model": params.Model,
|
|
"text": params.Text,
|
|
"words": words,
|
|
"toxicity": map[string]float64{
|
|
"insult": 0,
|
|
"obscenity": 0,
|
|
"threat": 0,
|
|
"politeness": 0,
|
|
},
|
|
"emotion": map[string]any{},
|
|
"voice_analysis": map[string]any{},
|
|
"status": "ready",
|
|
"taskID": params.ID,
|
|
"created": params.Created,
|
|
"processed": params.Processed,
|
|
}
|
|
}
|