Documentation
¶
Index ¶
- Constants
- func ErrorHandle(err *types.TaskResponse[any]) *types.OpenAIError
- func RequestErrorHandle(resp *http.Response) *types.OpenAIError
- type FetchReq
- type GoAPIFetchResponseData
- type GoAPITaskResponse
- type GoAPITaskResponseData
- type SunoAccount
- type SunoDataResponse
- type SunoGoAPISubmitReq
- type SunoGoAPISubmitReqInput
- type SunoLyrics
- type SunoMetadata
- type SunoProvider
- func (s *SunoProvider) GetAccount() (data *types.TaskResponse[SunoAccount], err error)
- func (s *SunoProvider) GetFetch(id string) (data *types.TaskResponse[SunoDataResponse], ...)
- func (s *SunoProvider) GetFetchs(ids []string) (data *types.TaskResponse[[]SunoDataResponse], ...)
- func (p *SunoProvider) GetRequestHeaders() (headers map[string]string)
- func (s *SunoProvider) Submit(action string, request *SunoSubmitReq) (data *types.TaskResponse[string], errWithCode *types.OpenAIErrorWithStatusCode)
- type SunoProviderFactory
- type SunoSong
- type SunoSubmitReq
Constants ¶
View Source
const ( SunoActionMusic = "MUSIC" SunoActionLyrics = "LYRICS" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GoAPIFetchResponseData ¶
type GoAPITaskResponse ¶
type GoAPITaskResponseData ¶
type GoAPITaskResponseData struct {
TaskID string `json:"task_id"`
}
type SunoAccount ¶
type SunoAccount struct {
SessionId string `json:"session_id"`
Cookie string `json:"cookie"`
Jwt string `json:"jwt"`
LastUpdate int64 `json:"last_update"`
CreditsLeft int `json:"credits_left"`
MonthlyLimit int `json:"monthly_limit"`
MonthlyUsage int `json:"monthly_usage"`
Period string `json:"period"`
IsActive bool `json:"is_active"`
}
type SunoDataResponse ¶
type SunoDataResponse struct {
TaskID string `json:"task_id" gorm:"type:varchar(50);index"`
Action string `json:"action" gorm:"type:varchar(40);index"` // 任务类型, song, lyrics, description-mode
Status string `json:"status" gorm:"type:varchar(20);index"` // 任务状态, submitted, queueing, processing, success, failed
FailReason string `json:"fail_reason"`
SubmitTime int64 `json:"submit_time" gorm:"index"`
StartTime int64 `json:"start_time" gorm:"index"`
FinishTime int64 `json:"finish_time" gorm:"index"`
Data datatypes.JSON `json:"data" gorm:"type:json"`
}
type SunoGoAPISubmitReq ¶
type SunoGoAPISubmitReq struct {
CustomMode bool `json:"custom_mode"`
Input SunoGoAPISubmitReqInput `json:"input"`
NotifyHook string `json:"notify_hook,omitempty"`
}
type SunoGoAPISubmitReqInput ¶
type SunoGoAPISubmitReqInput struct {
GptDescriptionPrompt string `json:"gpt_description_prompt"`
Prompt string `json:"prompt"`
Mv string `json:"mv"`
Title string `json:"title"`
Tags string `json:"tags"`
ContinueAt float64 `json:"continue_at"`
TaskID string `json:"task_id"`
ContinueClipId string `json:"continue_clip_id"`
MakeInstrumental bool `json:"make_instrumental"`
}
type SunoLyrics ¶
type SunoMetadata ¶
type SunoMetadata struct {
Tags string `json:"tags"`
Prompt string `json:"prompt"`
GPTDescriptionPrompt interface{} `json:"gpt_description_prompt"`
AudioPromptID interface{} `json:"audio_prompt_id"`
Duration interface{} `json:"duration"`
ErrorType interface{} `json:"error_type"`
ErrorMessage interface{} `json:"error_message"`
}
type SunoProvider ¶
type SunoProvider struct {
openai.OpenAIProvider
Account string
Fetchs string
Fetch string
SubmitMusic string
SubmitLyrics string
}
func (*SunoProvider) GetAccount ¶
func (s *SunoProvider) GetAccount() (data *types.TaskResponse[SunoAccount], err error)
func (*SunoProvider) GetFetch ¶
func (s *SunoProvider) GetFetch(id string) (data *types.TaskResponse[SunoDataResponse], errWithCode *types.OpenAIErrorWithStatusCode)
func (*SunoProvider) GetFetchs ¶
func (s *SunoProvider) GetFetchs(ids []string) (data *types.TaskResponse[[]SunoDataResponse], errWithCode *types.OpenAIErrorWithStatusCode)
func (*SunoProvider) GetRequestHeaders ¶
func (p *SunoProvider) GetRequestHeaders() (headers map[string]string)
func (*SunoProvider) Submit ¶
func (s *SunoProvider) Submit(action string, request *SunoSubmitReq) (data *types.TaskResponse[string], errWithCode *types.OpenAIErrorWithStatusCode)
type SunoProviderFactory ¶
type SunoProviderFactory struct{}
定义供应商工厂
func (SunoProviderFactory) Create ¶
func (f SunoProviderFactory) Create(channel *model.Channel) base.ProviderInterface
创建 SunoProvider
type SunoSong ¶
type SunoSong struct {
ID string `json:"id"`
VideoURL string `json:"video_url"`
AudioURL string `json:"audio_url"`
ImageURL string `json:"image_url"`
ImageLargeURL string `json:"image_large_url"`
MajorModelVersion string `json:"major_model_version"`
ModelName string `json:"model_name"`
Status string `json:"status"`
Title string `json:"title"`
Text string `json:"text"`
Metadata SunoMetadata `json:"metadata"`
}
type SunoSubmitReq ¶
type SunoSubmitReq struct {
GptDescriptionPrompt string `json:"gpt_description_prompt,omitempty"`
Prompt string `json:"prompt,omitempty"`
Mv string `json:"mv,omitempty"`
Title string `json:"title,omitempty"`
Tags string `json:"tags,omitempty"`
ContinueAt float64 `json:"continue_at,omitempty"`
TaskID string `json:"task_id,omitempty"`
ContinueClipId string `json:"continue_clip_id,omitempty"`
MakeInstrumental bool `json:"make_instrumental"`
}
Click to show internal directories.
Click to hide internal directories.