mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-10 08:03:41 +08:00
feat: suno api 支持
feat: 调试 suno feat: 补充suno 文档
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package constant
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
RelayModeUnknown = iota
|
||||
@@ -26,6 +29,9 @@ const (
|
||||
RelayModeMidjourneyModal
|
||||
RelayModeMidjourneyShorten
|
||||
RelayModeSwapFace
|
||||
RelayModeSunoFetch
|
||||
RelayModeSunoFetchByID
|
||||
RelayModeSunoSubmit
|
||||
)
|
||||
|
||||
func Path2RelayMode(path string) int {
|
||||
@@ -89,3 +95,15 @@ func Path2RelayModeMidjourney(path string) int {
|
||||
}
|
||||
return relayMode
|
||||
}
|
||||
|
||||
func Path2RelaySuno(method, path string) int {
|
||||
relayMode := RelayModeUnknown
|
||||
if method == http.MethodPost && strings.HasSuffix(path, "/fetch") {
|
||||
relayMode = RelayModeSunoFetch
|
||||
} else if method == http.MethodGet && strings.Contains(path, "/fetch/") {
|
||||
relayMode = RelayModeSunoFetchByID
|
||||
} else if strings.Contains(path, "/submit/") {
|
||||
relayMode = RelayModeSunoSubmit
|
||||
}
|
||||
return relayMode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user