Documentation ¶
Index ¶
- Variables
- type Account
- type AccountInfoResponsePayload
- type AuthorInfo
- type AuthorPayload
- type Avatar
- type AvatarJSON
- type AvatarRequestItem
- type CandidatePayload
- type Character
- type CharacterInfoPayload
- type CharacterInfoResponse
- type CharacterSearchResult
- type CharacterShort
- type CharacterVotePayload
- type CharacterVoteResponse
- type Chat
- type ChatHistory
- type ChatInfo
- type ChatPayload
- type Client
- func (c *Client) AnotherResponse(characterID, chatID, turnID string) (*Turn, error)
- func (c *Client) ArchiveChat(chatID string) error
- func (c *Client) Authenticate() error
- func (c *Client) CharacterVote(characterID string, vote *bool) error
- func (c *Client) Close() error
- func (c *Client) CopyChat(chatID string, endTurnID string) (string, error)
- func (c *Client) CreateCharacter(name, greeting string, title, description, definition string, copyable bool, ...) (*Character, error)
- func (c *Client) CreateChat(characterID string, greeting bool) (*Chat, *Turn, error)
- func (c *Client) CreatePersona(name string, definition string, avatarRelPath string) (*Persona, error)
- func (c *Client) DeleteMessage(chatID string, turnID string) error
- func (c *Client) DeleteMessages(chatID string, turnIDs []string) error
- func (c *Client) DeletePersona(personaID string) error
- func (c *Client) DeleteVoice(voiceID string) error
- func (c *Client) EditAccount(name string, username string, bio string, avatarRelPath string) error
- func (c *Client) EditCharacter(characterID, name, greeting string, title, description, definition string, ...) (*Character, error)
- func (c *Client) EditMessage(chatID string, turnID string, candidateID string, text string) (*Turn, error)
- func (c *Client) EditPersona(personaID string, name string, definition string, avatarRelPath string) (*Persona, error)
- func (c *Client) EditVoice(voiceID string, name string, description string, visibility string) (*Voice, error)
- func (c *Client) FetchAllMessages(chatID string, pinnedOnly bool) ([]*Turn, error)
- func (c *Client) FetchCharacterInfo(characterID string) (*Character, error)
- func (c *Client) FetchCharactersByCategory() (map[string][]*CharacterShort, error)
- func (c *Client) FetchChat(chatID string) (*Chat, error)
- func (c *Client) FetchChats(characterID string, numPreviewTurns int) ([]*Chat, error)
- func (c *Client) FetchFeaturedCharacters() ([]*CharacterShort, error)
- func (c *Client) FetchHistories(characterID string, amount int) ([]ChatHistory, error)
- func (c *Client) FetchMe() (*UserAccount, error)
- func (c *Client) FetchMessages(chatID string, pinnedOnly bool, nextToken string) ([]*Turn, string, error)
- func (c *Client) FetchMyCharacters() ([]*CharacterShort, error)
- func (c *Client) FetchMyFollowers() ([]*PublicUser, error)
- func (c *Client) FetchMyFollowing() ([]*PublicUser, error)
- func (c *Client) FetchMyPersona(personaID string) (*Persona, error)
- func (c *Client) FetchMyPersonas() ([]*Character, error)
- func (c *Client) FetchMySettings() (*Settings, error)
- func (c *Client) FetchMyUpvotedCharacters() ([]*CharacterShort, error)
- func (c *Client) FetchMyVoices() ([]*Voice, error)
- func (c *Client) FetchRecentChats() ([]*Chat, error)
- func (c *Client) FetchRecommendedCharacters() ([]*CharacterShort, error)
- func (c *Client) FetchSimilarCharacters(characterID string) ([]*CharacterShort, error)
- func (c *Client) FetchUser(username string) (*PublicUser, error)
- func (c *Client) FetchUserVoices(username string) ([]*Voice, error)
- func (c *Client) FetchVoice(voiceID string) (*Voice, error)
- func (c *Client) FollowUser(username string) error
- func (c *Client) GenerateImage(prompt string, numCandidates int) ([]string, error)
- func (c *Client) GenerateSpeech(chatID string, turnID string, candidateID string, voiceID string) ([]byte, error)
- func (c *Client) GetHeaders(includeWebNextAuth bool) map[string]string
- func (c *Client) GetSelf() (*UserAccount, error)
- func (c *Client) PinMessage(chatID string, turnID string) error
- func (c *Client) Ping() (bool, error)
- func (c *Client) SearchCharacters(query string) ([]*CharacterSearchResult, error)
- func (c *Client) SearchCreators(query string) ([]Creator, error)
- func (c *Client) SearchVoices(query string) ([]*Voice, error)
- func (c *Client) SendMessage(characterID, chatID, text string) (*Turn, error)
- func (c *Client) SetDefaultPersona(personaID string) error
- func (c *Client) SetPersona(characterID string, personaID string) error
- func (c *Client) SetVoice(characterID string, voiceID string) error
- func (c *Client) UnarchiveChat(chatID string) error
- func (c *Client) UnfollowUser(username string) error
- func (c *Client) UnpinMessage(chatID string, turnID string) error
- func (c *Client) UnsetDefaultPersona() error
- func (c *Client) UnsetPersona(characterID string) error
- func (c *Client) UnsetVoice(characterID string) error
- func (c *Client) UpdateChatName(chatID string, name string) error
- func (c *Client) UpdatePrimaryCandidate(chatID string, turnID string, candidateID string) error
- func (c *Client) UpdateSettings(newSettings *Settings) (*Settings, error)
- func (c *Client) UploadAvatar(imagePath string, checkImage bool) (*Avatar, error)
- func (c *Client) UploadVoice(voiceData []byte, name string, description string, visibility string) (*Voice, error)
- type CopyChatRequest
- type CopyChatResponse
- type CreateAndGenerateTurnPayload
- type CreateCharacterPayload
- type CreateCharacterResult
- type CreateChatPayload
- type CreateChatResponsePayload
- type CreatePersonaPayload
- type CreatePersonaResult
- type Creator
- type CreatorInfo
- type DeletePersonaResult
- type EditCharacterPayload
- type EditCharacterResult
- type EditPersonaPayload
- type EditPersonaResult
- type EditTurnCandidatePayload
- type ErrorResponse
- type FetchChatsResponse
- type FetchHistoriesRequest
- type FetchHistoriesResponse
- type FetchMeResponse
- type FetchMessagesResponse
- type FetchUserRequest
- type FetchUserResponse
- type FetchVoiceResponse
- type FollowUserRequest
- type FollowUserResponse
- type GenerateImageRequest
- type GenerateImageResponse
- type GenerateSpeechPayload
- type GenerateSpeechResponse
- type GenerateTurnCandidatePayload
- type HistoryMessage
- type HistoryMessageActor
- type ImageResult
- type MarkNotificationsReadPayload
- type Meta
- type Notification
- type NotificationsResponsePayload
- type Persona
- type PreviousAnnotations
- type PublicUser
- type RemoveTurnsPayload
- type Requester
- func (r *Requester) CloseWebSocket() error
- func (r *Requester) DoRequest(method, urlStr string, headers map[string]string, body []byte) (*http.Response, error)
- func (r *Requester) Get(urlStr string, headers map[string]string) (*http.Response, error)
- func (r *Requester) InitializeWebSocket() error
- func (r *Requester) ListenWebSocketMessages(messages chan<- []byte)
- func (r *Requester) Post(urlStr string, headers map[string]string, body []byte) (*http.Response, error)
- func (r *Requester) ReceiveRawWebSocketMessage() ([]byte, error)
- func (r *Requester) SendWebSocketMessage(message WebSocketMessage) error
- type SearchCreatorsResponse
- type SearchVoicesResponse
- type SetTurnPinPayload
- type SetVoicePayload
- type SetVoiceResponse
- type Settings
- type Turn
- type TurnCandidate
- type TurnKey
- type TurnPayload
- type TurnResponsePayload
- type UpdateChatNamePayload
- type UpdatePrimaryCandidatePayload
- type UpdateProfilePayload
- type UploadAvatarRequest
- type UploadAvatarResponse
- type UploadVoiceInfo
- type UploadVoiceMetadata
- type UploadVoiceResponse
- type User
- type UserAccount
- type Voice
- type VoiceInfo
- type VoiceUpdatePayload
- type WebSocketMessage
- type WebSocketResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAuthenticationFailed indicates authentication failure ErrAuthenticationFailed = errors.New("authentication failed") // ErrInvalidResponse indicates an invalid response from the server ErrInvalidResponse = errors.New("invalid response from server") )
Functions ¶
This section is empty.
Types ¶
type Account ¶ added in v0.1.0
type Account struct { Name string `json:"name"` AvatarType string `json:"avatar_type"` OnboardingComplete bool `json:"onboarding_complete"` AvatarFileName string `json:"avatar_file_name"` MobileOnboardingComplete bool `json:"mobile_onboarding_complete,omitempty"` }
Account represents the "account" object inside the inner user.
type AccountInfoResponsePayload ¶ added in v0.1.0
type AccountInfoResponsePayload struct {
Account UserAccount `json:"account"`
}
type AuthorInfo ¶ added in v0.1.0
type AuthorInfo struct { AuthorID string `json:"author_id"` Name string `json:"name"` IsHuman bool `json:"is_human"` }
AuthorInfo represents the author of a turn
type AuthorPayload ¶ added in v0.1.0
type Avatar ¶ added in v0.1.0
type Avatar struct {
FileName string `json:"file_name"`
}
Avatar represents an avatar image.
type AvatarJSON ¶ added in v0.1.0
type AvatarJSON struct {
ImageDataURL string `json:"imageDataUrl"`
}
AvatarJSON contains the image data URL.
type AvatarRequestItem ¶ added in v0.1.0
type AvatarRequestItem struct {
JSON AvatarJSON `json:"json"`
}
AvatarRequestItem represents a single request item in the avatar upload payload.
type CandidatePayload ¶ added in v0.1.0
type Character ¶
type Character struct { ExternalID string `json:"external_id"` Title string `json:"title"` Name string `json:"name"` ParticipantName string `json:"participant__name"` Visibility string `json:"visibility"` Greeting string `json:"greeting"` Description string `json:"description"` Definition string `json:"definition"` Upvotes int64 `json:"upvotes"` AuthorUsername string `json:"user__username"` NumInteractions int64 `json:"participant__num_interactions"` AvatarFileName string `json:"avatar_file_name"` Avatar *Avatar `json:"-"` Copyable bool `json:"copyable"` Identifier string `json:"identifier"` ImgGenEnabled bool `json:"img_gen_enabled"` BaseImgPrompt string `json:"base_img_prompt"` ImgPromptRegex string `json:"img_prompt_regex"` StripImgPrompt bool `json:"strip_img_prompt_from_msg"` StarterPrompts map[string]interface{} `json:"starter_prompts"` CommentsEnabled *bool `json:"comments_enabled"` CreatorName string `json:"participant__user__username"` VoiceID string `json:"voice_id"` DefaultVoiceID string `json:"default_voice_id"` Songs []string `json:"songs"` }
Character represents a CharacterAI character.
func (*Character) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON custom unmarshalling for Character.
type CharacterInfoPayload ¶ added in v0.1.0
type CharacterInfoPayload struct {
ExternalID string `json:"external_id"`
}
CharacterInfoPayload represents the request payload for fetching character info.
type CharacterInfoResponse ¶ added in v0.1.0
type CharacterInfoResponse struct { Status string `json:"status"` Character *Character `json:"character"` Error string `json:"error"` }
CharacterInfoResponse represents the response payload for fetching character info.
type CharacterSearchResult ¶ added in v0.1.0
type CharacterSearchResult struct { DocumentID string `json:"document_id"` ExternalID string `json:"external_id"` Title string `json:"title"` Greeting string `json:"greeting"` AvatarFileName string `json:"avatar_file_name"` Avatar *Avatar `json:"-"` Visibility string `json:"visibility"` ParticipantName string `json:"participant__name"` ParticipantInteractions float64 `json:"participant__num_interactions"` AuthorUsername string `json:"user__username"` Priority float64 `json:"priority"` SearchScore float64 `json:"search_score"` Name string `json:"-"` }
func (*CharacterSearchResult) UnmarshalJSON ¶ added in v0.1.0
func (csr *CharacterSearchResult) UnmarshalJSON(data []byte) error
type CharacterShort ¶ added in v0.1.0
type CharacterShort struct { CharacterID string `json:"external_id"` Title string `json:"title"` Greeting string `json:"greeting"` AvatarFileName string `json:"avatar_file_name"` Avatar *Avatar `json:"-"` Copyable bool `json:"copyable"` ParticipantName string `json:"participant__name"` AuthorUsername string `json:"user__username"` NumInteractions int64 `json:"participant__num_interactions"` ImgGenEnabled bool `json:"img_gen_enabled"` Priority float32 `json:"priority"` DefaultVoiceID *string `json:"default_voice_id"` Upvotes int64 `json:"upvotes"` Name string `json:"-"` }
CharacterShort represents a summary of a character.
func (*CharacterShort) UnmarshalJSON ¶ added in v0.1.0
func (cs *CharacterShort) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for CharacterShort.
type CharacterVotePayload ¶ added in v0.1.0
type CharacterVotePayload struct { ExternalID string `json:"external_id"` Vote *bool `json:"vote"` // Pointer to bool to handle nil (removing vote) }
CharacterVotePayload represents the request payload for voting on a character.
type CharacterVoteResponse ¶ added in v0.1.0
CharacterVoteResponse represents the response payload after voting.
type Chat ¶
type Chat struct { ChatID string `json:"chat_id"` CharacterID string `json:"character_id"` CreatorID string `json:"creator_id"` CreateTimeStr string `json:"create_time"` CreateTime time.Time `json:"-"` State string `json:"state"` ChatType string `json:"type"` Visibility string `json:"visibility"` PreviewTurns []*Turn `json:"preview_turns,omitempty"` ChatName string `json:"name,omitempty"` CharacterName string `json:"character_name,omitempty"` CharacterAvatarURI string `json:"character_avatar_uri,omitempty"` CharacterAvatar *Avatar `json:"-"` }
Chat represents a chat session.
func (*Chat) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON custom unmarshalling for Chat.
type ChatHistory ¶ added in v0.0.3
type ChatHistory struct { ChatID string `json:"external_id"` CreateTimeStr string `json:"created"` CreateTime time.Time `json:"-"` LastInteractionStr string `json:"last_interaction"` LastInteraction time.Time `json:"-"` PreviewMessages []HistoryMessage `json:"msgs"` }
ChatHistory represents the chat history.
func (*ChatHistory) UnmarshalJSON ¶ added in v0.1.0
func (ch *ChatHistory) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for ChatHistory.
type ChatPayload ¶ added in v0.1.0
type Client ¶ added in v0.1.0
type Client struct { Token string WebNextAuth string UserAccountID string Requester *Requester // contains filtered or unexported fields }
Client is the main client structure
func (*Client) AnotherResponse ¶ added in v0.1.0
func (*Client) ArchiveChat ¶ added in v0.1.0
ArchiveChat archives a chat
func (*Client) Authenticate ¶ added in v0.1.0
Authenticate retrieves the account ID
func (*Client) CharacterVote ¶ added in v0.1.0
CharacterVote casts a vote for a character. Use 'nil' for removing a vote.
func (*Client) CreateCharacter ¶ added in v0.1.0
func (c *Client) CreateCharacter(name, greeting string, title, description, definition string, copyable bool, visibility, avatarRelPath, defaultVoiceID string) (*Character, error)
CreateCharacter creates a new character.
func (*Client) CreateChat ¶ added in v0.1.0
CreateChat creates a new chat with a character
func (*Client) CreatePersona ¶ added in v0.1.0
func (c *Client) CreatePersona(name string, definition string, avatarRelPath string) (*Persona, error)
CreatePersona creates a new persona.
func (*Client) DeleteMessage ¶ added in v0.1.0
func (*Client) DeleteMessages ¶ added in v0.1.0
DeleteMessages deletes messages from a chat
func (*Client) DeletePersona ¶ added in v0.1.0
DeletePersona deletes a persona by marking it as archived.
func (*Client) DeleteVoice ¶ added in v0.1.0
DeleteVoice deletes a voice by its ID.
func (*Client) EditAccount ¶ added in v0.1.0
EditAccount edits the user's account information.
func (*Client) EditCharacter ¶ added in v0.1.0
func (c *Client) EditCharacter(characterID, name, greeting string, title, description, definition string, copyable bool, visibility, avatarRelPath, defaultVoiceID string) (*Character, error)
EditCharacter edits an existing character.
func (*Client) EditMessage ¶ added in v0.1.0
func (c *Client) EditMessage(chatID string, turnID string, candidateID string, text string) (*Turn, error)
EditMessage edits a message in a turn
func (*Client) EditPersona ¶ added in v0.1.0
func (c *Client) EditPersona(personaID string, name string, definition string, avatarRelPath string) (*Persona, error)
EditPersona edits an existing persona.
func (*Client) EditVoice ¶ added in v0.1.0
func (c *Client) EditVoice(voiceID string, name string, description string, visibility string) (*Voice, error)
EditVoice edits an existing voice.
func (*Client) FetchAllMessages ¶ added in v0.1.0
FetchAllMessages retrieves all messages from a chat
func (*Client) FetchCharacterInfo ¶ added in v0.1.0
FetchCharacterInfo retrieves information about a character.
func (*Client) FetchCharactersByCategory ¶ added in v0.1.0
func (c *Client) FetchCharactersByCategory() (map[string][]*CharacterShort, error)
FetchCharactersByCategory retrieves characters categorized by curated categories.
func (*Client) FetchChats ¶ added in v0.1.0
FetchChats retrieves chats for a character
func (*Client) FetchFeaturedCharacters ¶ added in v0.1.0
func (c *Client) FetchFeaturedCharacters() ([]*CharacterShort, error)
FetchFeaturedCharacters retrieves featured characters.
func (*Client) FetchHistories ¶ added in v0.1.0
func (c *Client) FetchHistories(characterID string, amount int) ([]ChatHistory, error)
FetchHistories retrieves chat histories for a character
func (*Client) FetchMe ¶ added in v0.1.0
func (c *Client) FetchMe() (*UserAccount, error)
FetchMe retrieves the account information.
func (*Client) FetchMessages ¶ added in v0.1.0
func (c *Client) FetchMessages(chatID string, pinnedOnly bool, nextToken string) ([]*Turn, string, error)
FetchMessages retrieves messages from a chat
func (*Client) FetchMyCharacters ¶ added in v0.1.0
func (c *Client) FetchMyCharacters() ([]*CharacterShort, error)
FetchMyCharacters retrieves all the user's characters.
func (*Client) FetchMyFollowers ¶ added in v0.1.0
func (c *Client) FetchMyFollowers() ([]*PublicUser, error)
FetchMyFollowers retrieves the user's followers.
func (*Client) FetchMyFollowing ¶ added in v0.1.0
func (c *Client) FetchMyFollowing() ([]*PublicUser, error)
FetchMyFollowing retrieves the users that the user is following.
func (*Client) FetchMyPersona ¶ added in v0.1.0
FetchMyPersona retrieves a user's persona by ID.
func (*Client) FetchMyPersonas ¶ added in v0.1.0
FetchMyPersonas retrieves all the user's personas.
func (*Client) FetchMySettings ¶ added in v0.1.0
FetchMySettings retrieves the user's settings.
func (*Client) FetchMyUpvotedCharacters ¶ added in v0.1.0
func (c *Client) FetchMyUpvotedCharacters() ([]*CharacterShort, error)
FetchMyUpvotedCharacters retrieves the characters the user has upvoted.
func (*Client) FetchMyVoices ¶ added in v0.1.0
FetchMyVoices retrieves the user's voices.
func (*Client) FetchRecentChats ¶ added in v0.1.0
FetchRecentChats retrieves recent chats for the user
func (*Client) FetchRecommendedCharacters ¶ added in v0.1.0
func (c *Client) FetchRecommendedCharacters() ([]*CharacterShort, error)
FetchRecommendedCharacters retrieves recommended characters for the user.
func (*Client) FetchSimilarCharacters ¶ added in v0.1.0
func (c *Client) FetchSimilarCharacters(characterID string) ([]*CharacterShort, error)
FetchSimilarCharacters retrieves characters similar to the given character.
func (*Client) FetchUser ¶ added in v0.1.0
func (c *Client) FetchUser(username string) (*PublicUser, error)
FetchUser retrieves a public user's information
func (*Client) FetchUserVoices ¶ added in v0.1.0
FetchUserVoices retrieves the voices created by a public user.
func (*Client) FetchVoice ¶ added in v0.1.0
FetchVoice retrieves a voice by its ID.
func (*Client) FollowUser ¶ added in v0.1.0
FollowUser follows a user
func (*Client) GenerateImage ¶ added in v0.1.0
GenerateImage generates images based on a prompt.
func (*Client) GenerateSpeech ¶ added in v0.1.0
func (c *Client) GenerateSpeech(chatID string, turnID string, candidateID string, voiceID string) ([]byte, error)
GenerateSpeech generates speech audio for a turn using a specific voice. Returns the audio data as bytes.
func (*Client) GetHeaders ¶ added in v0.1.0
GetHeaders returns the headers for requests
func (*Client) GetSelf ¶ added in v0.1.0
func (c *Client) GetSelf() (*UserAccount, error)
GetSelf is an alias for FetchMe.
func (*Client) PinMessage ¶ added in v0.1.0
PinMessage pins a message in a chat
func (*Client) SearchCharacters ¶ added in v0.1.0
func (c *Client) SearchCharacters(query string) ([]*CharacterSearchResult, error)
SearchCharacters searches for characters by name.
func (*Client) SearchCreators ¶ added in v0.1.0
SearchCreators searches for creators by name.
func (*Client) SearchVoices ¶ added in v0.1.0
SearchVoices searches for voices by name.
func (*Client) SendMessage ¶ added in v0.1.0
func (*Client) SetDefaultPersona ¶ added in v0.1.0
SetDefaultPersona sets the default persona for the user.
func (*Client) SetPersona ¶ added in v0.1.0
SetPersona sets the persona override for a character.
func (*Client) UnarchiveChat ¶ added in v0.1.0
UnarchiveChat unarchives a chat
func (*Client) UnfollowUser ¶ added in v0.1.0
UnfollowUser unfollows a user
func (*Client) UnpinMessage ¶ added in v0.1.0
UnpinMessage unpins a message in a chat
func (*Client) UnsetDefaultPersona ¶ added in v0.1.0
UnsetDefaultPersona unsets the default persona for the user.
func (*Client) UnsetPersona ¶ added in v0.1.0
UnsetPersona unsets the persona override for a character.
func (*Client) UnsetVoice ¶ added in v0.1.0
UnsetVoice unsets the voice override for a character.
func (*Client) UpdateChatName ¶ added in v0.1.0
UpdateChatName updates the name of a chat
func (*Client) UpdatePrimaryCandidate ¶ added in v0.1.0
UpdatePrimaryCandidate updates the primary candidate of a turn
func (*Client) UpdateSettings ¶ added in v0.1.0
UpdateSettings updates the user's settings.
func (*Client) UploadAvatar ¶ added in v0.1.0
UploadAvatar uploads a new avatar for the user. The imagePath can be a local file path or a URL. The checkImage parameter determines whether to verify the uploaded image.
func (*Client) UploadVoice ¶ added in v0.1.0
func (c *Client) UploadVoice(voiceData []byte, name string, description string, visibility string) (*Voice, error)
UploadVoice uploads a new voice. The voiceData parameter should contain the voice file's data in bytes. The visibility parameter should be "public" or "private".
type CopyChatRequest ¶ added in v0.1.0
type CopyChatRequest struct {
EndTurnID string `json:"end_turn_id"`
}
type CopyChatResponse ¶ added in v0.1.0
type CopyChatResponse struct {
NewChatID string `json:"new_chat_id"`
}
type CreateAndGenerateTurnPayload ¶ added in v0.1.0
type CreateAndGenerateTurnPayload struct { CharacterID string `json:"character_id"` NumCandidates int `json:"num_candidates"` PreviousAnnotations PreviousAnnotations `json:"previous_annotations"` SelectedLanguage string `json:"selected_language"` TTSEnabled bool `json:"tts_enabled"` Turn TurnPayload `json:"turn"` UserName string `json:"user_name"` }
CreateAndGenerateTurnPayload represents the payload for creating and generating a turn.
type CreateCharacterPayload ¶ added in v0.1.0
type CreateCharacterPayload struct { Name string `json:"name"` Title string `json:"title"` Definition string `json:"definition"` Greeting string `json:"greeting"` Description string `json:"description"` Visibility string `json:"visibility"` AvatarRelPath string `json:"avatar_rel_path,omitempty"` BaseImgPrompt string `json:"base_img_prompt"` Categories []string `json:"categories"` Copyable bool `json:"copyable"` DefaultVoiceID string `json:"default_voice_id"` Identifier string `json:"identifier"` ImgGenEnabled bool `json:"img_gen_enabled"` StripImgPromptFromMsg bool `json:"strip_img_prompt_from_msg"` VoiceID string `json:"voice_id"` }
CreateCharacterPayload represents the payload for creating a character.
type CreateCharacterResult ¶ added in v0.1.0
type CreateCharacterResult struct { Status string `json:"status"` Character *Character `json:"character"` Error string `json:"error"` }
CreateCharacterResult represents the result of creating a character.
type CreateChatPayload ¶ added in v0.1.0
type CreateChatPayload struct { Chat ChatPayload `json:"chat"` WithGreeting bool `json:"with_greeting"` }
type CreateChatResponsePayload ¶ added in v0.1.0
type CreatePersonaPayload ¶ added in v0.1.0
type CreatePersonaPayload struct { Name string `json:"name"` Title string `json:"title"` Definition string `json:"definition"` Greeting string `json:"greeting"` Description string `json:"description"` Visibility string `json:"visibility"` AvatarFileName string `json:"avatar_file_name"` AvatarRelPath string `json:"avatar_rel_path,omitempty"` VoiceID string `json:"voice_id"` Identifier string `json:"identifier"` Categories []string `json:"categories"` BaseImgPrompt string `json:"base_img_prompt"` ImgGenEnabled bool `json:"img_gen_enabled"` Copyable bool `json:"copyable"` StripImgPromptFromMsg bool `json:"strip_img_prompt_from_msg"` }
CreatePersonaPayload represents the payload for creating a persona.
type CreatePersonaResult ¶ added in v0.1.0
type Creator ¶ added in v0.1.0
type Creator struct {
Name string `json:"name"`
}
Creator represents a creator in the system.
type CreatorInfo ¶ added in v0.1.0
CreatorInfo represents the creator information inside Voice.
type DeletePersonaResult ¶ added in v0.1.0
type EditCharacterPayload ¶ added in v0.1.0
type EditCharacterPayload struct { ExternalID string `json:"external_id"` Name string `json:"name"` Title string `json:"title"` Definition string `json:"definition"` Greeting string `json:"greeting"` Description string `json:"description"` Visibility string `json:"visibility"` AvatarRelPath string `json:"avatar_rel_path,omitempty"` BaseImgPrompt string `json:"base_img_prompt"` Categories []string `json:"categories"` Copyable bool `json:"copyable"` DefaultVoiceID string `json:"default_voice_id"` ImgGenEnabled bool `json:"img_gen_enabled"` StripImgPromptFromMsg bool `json:"strip_img_prompt_from_msg"` VoiceID string `json:"voice_id"` Archived bool `json:"archived"` }
EditCharacterPayload represents the payload for editing a character.
type EditCharacterResult ¶ added in v0.1.0
type EditCharacterResult struct { Status string `json:"status"` Character *Character `json:"character"` Error string `json:"error"` }
EditCharacterResult represents the result of editing a character.
type EditPersonaPayload ¶ added in v0.1.0
type EditPersonaPayload struct { ExternalID string `json:"external_id"` Name string `json:"name"` Title string `json:"title"` Definition string `json:"definition"` Greeting string `json:"greeting"` Description string `json:"description"` Visibility string `json:"visibility"` AvatarFileName string `json:"avatar_file_name"` AvatarRelPath string `json:"avatar_rel_path,omitempty"` VoiceID string `json:"voice_id"` Identifier string `json:"identifier"` Categories []string `json:"categories"` BaseImgPrompt string `json:"base_img_prompt"` ImgGenEnabled bool `json:"img_gen_enabled"` Copyable bool `json:"copyable"` StripImgPromptFromMsg bool `json:"strip_img_prompt_from_msg"` Archived bool `json:"archived,omitempty"` // For deleting personas }
EditPersonaPayload represents the payload for editing a persona.
type EditPersonaResult ¶ added in v0.1.0
type EditTurnCandidatePayload ¶ added in v0.1.0
type ErrorResponse ¶ added in v0.1.0
type ErrorResponse struct { Error struct { Message string `json:"message"` } `json:"error"` }
ErrorResponse represents an error response from the API.
type FetchChatsResponse ¶ added in v0.1.0
type FetchChatsResponse struct {
Chats []*Chat `json:"chats"`
}
type FetchHistoriesRequest ¶ added in v0.1.0
type FetchHistoriesResponse ¶ added in v0.1.0
type FetchHistoriesResponse struct {
Histories []ChatHistory `json:"histories"`
}
type FetchMeResponse ¶ added in v0.1.0
type FetchMeResponse struct {
User UserAccount `json:"user"`
}
FetchMeResponse represents the response from the FetchMe API call
type FetchMessagesResponse ¶ added in v0.1.0
type FetchUserRequest ¶ added in v0.1.0
type FetchUserRequest struct {
Username string `json:"username"`
}
FetchUserRequest represents the request payload for fetching a user's public information.
type FetchUserResponse ¶ added in v0.1.0
type FetchUserResponse struct {
PublicUser *PublicUser `json:"public_user"`
}
FetchUserResponse represents the response payload when fetching a user's public information.
type FetchVoiceResponse ¶ added in v0.1.0
type FetchVoiceResponse struct {
Voice *Voice `json:"voice"`
}
FetchVoiceResponse represents the response for fetching a voice.
type FollowUserRequest ¶ added in v0.1.0
type FollowUserRequest struct {
Username string `json:"username"`
}
FollowUserRequest represents the request payload for following/unfollowing a user.
type FollowUserResponse ¶ added in v0.1.0
type FollowUserResponse struct { Status string `json:"status"` Error string `json:"error,omitempty"` }
FollowUserResponse represents the response payload after following/unfollowing a user.
type GenerateImageRequest ¶ added in v0.1.0
type GenerateImageRequest struct { Prompt string `json:"prompt"` NumCandidates int `json:"num_candidates"` ModelVersion string `json:"model_version"` }
GenerateImageRequest represents the request payload for generating images.
type GenerateImageResponse ¶ added in v0.1.0
type GenerateImageResponse struct {
Result []ImageResult `json:"result"`
}
type GenerateSpeechPayload ¶ added in v0.1.0
type GenerateSpeechPayload struct { CandidateID string `json:"candidateId"` RoomID string `json:"roomId"` TurnID string `json:"turnId"` VoiceID string `json:"voiceId"` }
GenerateSpeechPayload represents the payload for generating speech.
type GenerateSpeechResponse ¶ added in v0.1.0
type GenerateSpeechResponse struct {
ReplayURL string `json:"replayUrl"`
}
GenerateSpeechResponse represents the response from generating speech.
type GenerateTurnCandidatePayload ¶ added in v0.1.0
type GenerateTurnCandidatePayload struct { CharacterID string `json:"character_id"` TTSEnabled bool `json:"tts_enabled"` PreviousAnnotations PreviousAnnotations `json:"previous_annotations"` SelectedLanguage string `json:"selected_language"` UserName string `json:"user_name"` TurnKey TurnKey `json:"turn_key"` }
type HistoryMessage ¶ added in v0.1.0
type HistoryMessage struct { ID int64 `json:"id"` Text string `json:"text"` Src *HistoryMessageActor `json:"src"` Tgt *HistoryMessageActor `json:"tgt"` IsAlternative bool `json:"is_alternative"` Annotable bool `json:"annotable"` DisplayName string `json:"display_name"` ImageRelativePath string `json:"image_rel_path"` CreateTimeStr string `json:"created"` CreateTime time.Time `json:"-"` }
func (*HistoryMessage) UnmarshalJSON ¶ added in v0.1.0
func (ch *HistoryMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for ChatHistory.
type HistoryMessageActor ¶ added in v0.1.0
type ImageResult ¶ added in v0.1.0
type ImageResult struct {
URL string `json:"url"`
}
ImageResult represents a single image result.
type MarkNotificationsReadPayload ¶ added in v0.1.0
type MarkNotificationsReadPayload struct {
NotificationIDs []string `json:"notification_ids"`
}
type Meta ¶ added in v0.1.0
type Meta struct {
NextToken string `json:"next_token"`
}
Meta information for pagination
type Notification ¶ added in v0.1.0
type Notification struct { NotificationID string `json:"notification_id"` Type string `json:"type"` Message string `json:"message"` IsRead bool `json:"is_read"` CreateTimeStr string `json:"create_time"` CreateTime time.Time `json:"-"` }
Notification represents a user notification.
func (*Notification) UnmarshalJSON ¶ added in v0.1.0
func (n *Notification) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for Notification.
type NotificationsResponsePayload ¶ added in v0.1.0
type NotificationsResponsePayload struct {
Notifications []Notification `json:"notifications"`
}
type Persona ¶ added in v0.1.0
type Persona struct { PersonaID string `json:"external_id"` Name string `json:"name"` Definition string `json:"definition"` Greeting string `json:"greeting"` Description string `json:"description"` AvatarFileName string `json:"avatar_file_name"` Avatar *Avatar `json:"-"` Visibility string `json:"visibility"` VoiceID string `json:"voice_id"` AuthorUsername string `json:"user__username"` Identifier string `json:"identifier"` Categories []string `json:"categories"` BaseImgPrompt string `json:"base_img_prompt"` ImgGenEnabled bool `json:"img_gen_enabled"` Copyable bool `json:"copyable"` StripImgPromptFromMsg bool `json:"strip_img_prompt_from_msg"` Archived bool `json:"archived,omitempty"` // For deleting personas }
Persona represents a persona.
func (*Persona) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON custom unmarshalling for Persona.
type PreviousAnnotations ¶ added in v0.1.0
PreviousAnnotations represents the annotations used in the request.
type PublicUser ¶ added in v0.1.0
type PublicUser struct { Username string `json:"username"` Name string `json:"name"` Bio string `json:"bio"` AvatarFileName string `json:"avatar_file_name"` Avatar *Avatar `json:"-"` NumFollowing int `json:"num_following"` NumFollowers int `json:"num_followers"` Characters []CharacterShort `json:"characters"` SubscriptionType string `json:"subscription_type"` }
PublicUser represents a public user profile.
func (*PublicUser) UnmarshalJSON ¶ added in v0.1.0
func (p *PublicUser) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for PublicUser.
type RemoveTurnsPayload ¶ added in v0.1.0
type Requester ¶ added in v0.1.0
type Requester struct {
// contains filtered or unexported fields
}
Requester handles HTTP and WebSocket requests
func NewRequester ¶ added in v0.1.0
NewRequester creates a new Requester instance
func (*Requester) CloseWebSocket ¶ added in v0.1.0
CloseWebSocket closes the WebSocket connection
func (*Requester) DoRequest ¶ added in v0.1.0
func (r *Requester) DoRequest(method, urlStr string, headers map[string]string, body []byte) (*http.Response, error)
DoRequest performs an HTTP request
func (*Requester) InitializeWebSocket ¶ added in v0.1.0
InitializeWebSocket initializes the WebSocket connection
func (*Requester) ListenWebSocketMessages ¶ added in v0.1.0
ListenWebSocketMessages listens for messages and sends them to a channel
func (*Requester) Post ¶ added in v0.1.0
func (r *Requester) Post(urlStr string, headers map[string]string, body []byte) (*http.Response, error)
Post performs a POST request
func (*Requester) ReceiveRawWebSocketMessage ¶ added in v0.1.0
ReceiveRawWebSocketMessage receives a raw message from the WebSocket connection
func (*Requester) SendWebSocketMessage ¶ added in v0.1.0
func (r *Requester) SendWebSocketMessage(message WebSocketMessage) error
SendWebSocketMessage sends a message over the WebSocket connection
type SearchCreatorsResponse ¶ added in v0.1.0
type SearchCreatorsResponse struct { Status string `json:"status"` Creators []Creator `json:"creators"` HasMore bool `json:"has_more"` Error string `json:"error"` }
SearchCreatorsResponse represents the response payload for searching creators.
type SearchVoicesResponse ¶ added in v0.1.0
type SearchVoicesResponse struct {
Voices []*Voice `json:"voices"`
}
SearchVoicesResponse represents the response for searching voices.
type SetTurnPinPayload ¶ added in v0.1.0
type SetVoicePayload ¶ added in v0.1.0
type SetVoicePayload struct {
VoiceID string `json:"voice_id"`
}
SetVoicePayload represents the payload for setting a voice override.
type SetVoiceResponse ¶ added in v0.1.0
SetVoiceResponse represents the response after setting a voice override.
type Settings ¶ added in v0.1.0
type Settings struct { DefaultPersonaID string `json:"default_persona_id"` EnableTTS bool `json:"enable_tts"` PersonaOverrides map[string]string `json:"personaOverrides"` }
Settings represents the user's settings.
func (*Settings) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON custom unmarshal to capture additional fields.
type Turn ¶ added in v0.1.0
type Turn struct { TurnKey TurnKey `json:"turn_key"` ChatID string `json:"-"` TurnID string `json:"-"` CreateTimeStr string `json:"create_time"` CreateTime time.Time `json:"-"` LastUpdateTimeStr string `json:"last_update_time"` LastUpdateTime time.Time `json:"-"` State string `json:"state"` Author AuthorInfo `json:"author"` CandidatesList []TurnCandidate `json:"candidates"` Candidates map[string]*TurnCandidate `json:"-"` PrimaryCandidateID string `json:"primary_candidate_id"` IsPinned bool `json:"is_pinned"` }
Turn represents a chat turn.
func (*Turn) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON custom unmarshalling for Turn.
type TurnCandidate ¶ added in v0.1.0
type TurnCandidate struct { CandidateID string `json:"candidate_id"` Text string `json:"raw_content"` IsFinal bool `json:"is_final"` IsFiltered bool `json:"safety_truncated"` CreateTimeStr string `json:"create_time"` CreateTime time.Time `json:"-"` }
TurnCandidate represents a candidate response.
func (*TurnCandidate) UnmarshalJSON ¶ added in v0.1.0
func (tc *TurnCandidate) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for TurnCandidate.
type TurnPayload ¶ added in v0.1.0
type TurnPayload struct { Author AuthorPayload `json:"author"` Candidates []CandidatePayload `json:"candidates"` PrimaryCandidateID string `json:"primary_candidate_id"` TurnKey TurnKey `json:"turn_key"` }
type TurnResponsePayload ¶ added in v0.1.0
type UpdateChatNamePayload ¶ added in v0.1.0
type UpdateChatNamePayload struct {
Name string `json:"name"`
}
UpdateChatNamePayload represents the payload for updating the chat name.
type UpdatePrimaryCandidatePayload ¶ added in v0.1.0
type UpdateProfilePayload ¶ added in v0.1.0
type UpdateProfilePayload struct { AvatarType string `json:"avatar_type"` Bio string `json:"bio"` Name string `json:"name"` Username string `json:"username"` AvatarRelPath string `json:"avatar_rel_path,omitempty"` // Additional fields that might be required Email string `json:"email,omitempty"` FirstName string `json:"first_name,omitempty"` IsHuman bool `json:"is_human,omitempty"` SubscriptionType string `json:"subscription_type,omitempty"` }
UpdateProfilePayload represents the payload for updating the user's profile.
type UploadAvatarRequest ¶ added in v0.1.0
type UploadAvatarRequest map[string]AvatarRequestItem
UploadAvatarRequest represents the request payload when uploading an avatar.
type UploadAvatarResponse ¶ added in v0.1.0
type UploadAvatarResponse struct { Result struct { Data struct { JSON string `json:"json"` } `json:"data"` } `json:"result"` }
UploadAvatarResponse represents the response when uploading an avatar.
type UploadVoiceInfo ¶ added in v0.1.0
type UploadVoiceInfo struct { Name string `json:"name"` Description string `json:"description"` Gender string `json:"gender"` Visibility string `json:"visibility"` PreviewText string `json:"previewText"` AudioSourceType string `json:"audioSourceType"` }
UploadVoiceInfo represents the voice information for upload.
type UploadVoiceMetadata ¶ added in v0.1.0
type UploadVoiceMetadata struct {
Voice UploadVoiceInfo `json:"voice"`
}
UploadVoiceMetadata represents the metadata for uploading a voice.
type UploadVoiceResponse ¶ added in v0.1.0
type UploadVoiceResponse struct {
Voice *Voice `json:"voice"`
}
UploadVoiceResponse represents the response after uploading or editing a voice.
type User ¶
type User struct { Username string `json:"username"` ID int64 `json:"id"` FirstName string `json:"first_name"` Account *Account `json:"account"` IsStaff bool `json:"is_staff"` Subscription bool `json:"subscription"` Entitlements []string `json:"entitlements"` }
User represents the inner "user" object in the JSON.
type UserAccount ¶ added in v0.1.0
type UserAccount struct { User *User `json:"user"` IsHuman bool `json:"is_human"` Name string `json:"name"` Email string `json:"email"` NeedsToAcknowledgePolicy bool `json:"needs_to_acknowledge_policy"` SuspendedUntil string `json:"suspended_until"` HiddenCharacters []string `json:"hidden_characters"` BlockedUsers []string `json:"blocked_users"` Bio string `json:"bio"` Interests string `json:"interests"` DateOfBirth string `json:"date_of_birth"` }
UserAccount represents a user account.
func (*UserAccount) UnmarshalJSON ¶ added in v0.1.0
func (a *UserAccount) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshalling for UserAccount to handle nested account data.
type Voice ¶ added in v0.1.0
type Voice struct { VoiceID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Gender string `json:"gender"` Visibility string `json:"visibility"` PreviewAudioURL string `json:"previewAudioURI"` PreviewText string `json:"previewText"` CreatorID string `json:"-"` CreatorUsername string `json:"-"` InternalStatus string `json:"internalStatus"` LastUpdateTime time.Time `json:"-"` CreatorInfo *CreatorInfo `json:"creatorInfo,omitempty"` LastUpdateTimeStr string `json:"lastUpdateTime"` }
Voice represents a voice setting.
func (*Voice) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON custom unmarshalling for Voice.
type VoiceInfo ¶ added in v0.1.0
type VoiceInfo struct { AudioSourceType string `json:"audioSourceType"` BackendID string `json:"backendId"` BackendProvider string `json:"backendProvider"` CreatorInfo *CreatorInfo `json:"creatorInfo"` Description string `json:"description"` Gender string `json:"gender"` ID string `json:"id"` InternalStatus string `json:"internalStatus"` LastUpdateTime string `json:"lastUpdateTime"` Name string `json:"name"` PreviewAudioURI string `json:"previewAudioURI"` PreviewText string `json:"previewText"` Visibility string `json:"visibility"` }
VoiceInfo represents the voice information for updates.
type VoiceUpdatePayload ¶ added in v0.1.0
type VoiceUpdatePayload struct {
Voice VoiceInfo `json:"voice"`
}
VoiceUpdatePayload represents the payload for updating a voice.
type WebSocketMessage ¶ added in v0.1.0
type WebSocketResponse ¶ added in v0.1.0
type WebSocketResponse struct { Command string `json:"command"` Payload json.RawMessage `json:"payload,omitempty"` Comment string `json:"comment,omitempty"` }