feat: 支持 MiniMax 音色克隆和 2.8 语音模型
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/easyai/easyai-ai-gateway/apps/api/internal/auth"
|
||||
)
|
||||
|
||||
// listClonedVoices godoc
|
||||
// @Summary 列出当前用户克隆音色
|
||||
// @Description 返回当前用户在网关中维护的克隆音色,以及克隆时绑定的平台与平台模型。
|
||||
// @Tags voice-clone
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} map[string]any
|
||||
// @Failure 401 {object} ErrorEnvelope
|
||||
// @Failure 500 {object} ErrorEnvelope
|
||||
// @Router /api/v1/voice_clone/voices [get]
|
||||
// @Router /v1/voice_clone/voices [get]
|
||||
// @Router /voice_clone/voices [get]
|
||||
func (s *Server) listClonedVoices(w http.ResponseWriter, r *http.Request) {
|
||||
user, ok := auth.UserFromContext(r.Context())
|
||||
if !ok {
|
||||
writeError(w, http.StatusUnauthorized, "unauthorized")
|
||||
return
|
||||
}
|
||||
if !apiKeyScopeAllowed(user, "voice.clone") {
|
||||
writeError(w, http.StatusForbidden, "api key scope does not allow this capability")
|
||||
return
|
||||
}
|
||||
items, err := s.store.ListClonedVoices(r.Context(), user)
|
||||
if err != nil {
|
||||
s.logger.Error("list cloned voices failed", "error", err)
|
||||
writeError(w, http.StatusInternalServerError, "list cloned voices failed")
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{"items": items})
|
||||
}
|
||||
Reference in New Issue
Block a user