Skip to content

Commit

Permalink
refactor(openai): use fo.May
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaa committed Dec 17, 2024
1 parent f97e7c6 commit 4c061e4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/backend/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/labstack/echo/v4"
"github.com/moeru-ai/unspeech/pkg/apierrors"
"github.com/nekomeowww/fo"
"github.com/samber/mo"
)

Expand All @@ -19,10 +20,7 @@ func openai(c echo.Context, options FullOptions) mo.Result[any] {
Speed: options.Speed,
}

payload, err := json.Marshal(values)
if err != nil {
return mo.Err[any](apierrors.NewErrBadRequest().WithCaller())
}
payload := fo.May(json.Marshal(values))

res, err := http.Post(
"https://openai.com/v1/audio/speech",
Expand Down

0 comments on commit 4c061e4

Please sign in to comment.