feat: 长文本语音合成

This commit is contained in:
Blizzard
2026-03-06 17:39:52 +08:00
parent 2583b5f302
commit dda4d2e1d6
24 changed files with 975 additions and 52 deletions
+17
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"errors"
"fmt"
"io"
"mime/multipart"
"path/filepath"
@@ -104,3 +105,19 @@ func (m *Minio) DeleteFile(key string) error {
err := m.Client.RemoveObject(ctx, m.bucket, key, minio.RemoveObjectOptions{})
return err
}
// UploadBytes 上传字节数据
func (m *Minio) UploadBytes(data []byte, key, contentType string) (string, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10)
defer cancel()
buffer := bytes.NewReader(data)
info, err := m.Client.PutObject(ctx, m.bucket, key, buffer, int64(len(data)), minio.PutObjectOptions{
ContentType: contentType,
})
if err != nil {
return "", fmt.Errorf("上传文件到minio失败: %v", err)
}
return fmt.Sprintf("%s/%s", global.Config.Minio.BucketUrl, info.Key), nil
}