Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
builds:
- main: ./cmd/unspeech
ldflags:
- -X main.version={{.Version}}
# remove 386
goarch:
- amd64
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -o ./result/unspeech ./cmd/unspeech
ARG VERSION=0.0.0

RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -ldflags="-X main.version=${VERSION}" -o ./result/unspeech ./cmd/unspeech

# https://github.com/GoogleContainerTools/distroless
FROM gcr.io/distroless/static-debian12 AS app
Expand Down
7 changes: 4 additions & 3 deletions cmd/unspeech/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import (
"github.com/moeru-ai/unspeech/pkg/ho"
)

var version = "0.0.0"

func main() {
rootCmd := &cobra.Command{
Use: "unspeech",
// TODO: set version
Version: "0.0.0",
Use: "unspeech",
Version: version,
RunE: func(cmd *cobra.Command, args []string) error {
slog.SetDefault(slog.New(tint.NewHandler(os.Stdout, nil)))

Expand Down
5 changes: 3 additions & 2 deletions internal/middlewares/error_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ func HandleErrors() echo.MiddlewareFunc {
slog.Error("unknown error responded", slog.Any("error", err.Error()))
}
if 500 >= errResp.Status || errResp.Status < 600 {
attrs := make([]slog.Attr, 0)
attrs = append(attrs, logs.Caller(errResp.Caller())...)
callerAttrs := logs.Caller(errResp.Caller())
attrs := make([]slog.Attr, 0, len(callerAttrs)+1)
attrs = append(attrs, callerAttrs...)
attrs = append(attrs, slog.Any("error", errResp.Error()))
slog.Error("error occurred during request", lo.ToAnySlice(attrs)...)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/backend/doubao/voices.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func HandleVoices(c echo.Context, options mo.Option[types.VoicesRequestOptions])
voices := make([]types.Voice, 0, len(voicesResponse))

for _, voice := range voicesResponse {
//nolint:mnd
voices = append(voices, types.Voice{
ID: voice.Voice,
Name: voice.Name,
Expand Down
10 changes: 5 additions & 5 deletions pkg/backend/microsoft/speech.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ type ssml struct {
}

type extraBody struct {
DisableSSML mo.Option[bool] `json:"disable_ssml,omitempty"`
DisableSSML mo.Option[bool] `json:"disable_ssml,omitzero"`
Region string `json:"region"`
DeploymentID mo.Option[string] `json:"deployment_id,omitempty"`
Lang mo.Option[string] `json:"lang,omitempty"`
Gender mo.Option[string] `json:"gender,omitempty"`
SampleRate mo.Option[uint] `json:"sample_rate,omitempty"`
DeploymentID mo.Option[string] `json:"deployment_id,omitzero"`
Lang mo.Option[string] `json:"lang,omitzero"`
Gender mo.Option[string] `json:"gender,omitzero"`
SampleRate mo.Option[uint] `json:"sample_rate,omitzero"`
}

var (
Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export default defineConfig({
dts: true,
entry: [join('src', 'index.ts')],
format: 'esm',
tsconfig: 'tsconfig.lib.json',
tsconfig: 'tsconfig.json',
})