chatgpt

package
v0.0.0-...-d16f7ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcProofToken

func CalcProofToken(seed string, diff string) string

func CreateConversation

func CreateConversation(c *gin.Context)

func CreateWSConn

func CreateWSConn(url string, connInfo *api.ConnInfo, retry int) error

func FindSpecConn

func FindSpecConn(token string, uuid string) *api.ConnInfo

func InitWSConn

func InitWSConn(token string, deviceId string, uuid string) error

func Login

func Login(c *gin.Context)

func NewRequest

func NewRequest(method string, url string, body io.Reader, token string, deviceId string) (*http.Request, error)

func RenewTokenForRequest

func RenewTokenForRequest(request *CreateConversationRequest, dx string)

func UnlockSpecConn

func UnlockSpecConn(token string, uuid string)

Types

type Author

type Author struct {
	Role string `json:"role"`
}

type ChatGPTWSSResponse

type ChatGPTWSSResponse struct {
	WssUrl         string `json:"wss_url"`
	ConversationId string `json:"conversation_id,omitempty"`
	ResponseId     string `json:"response_id,omitempty"`
}

type ChatRequire

type ChatRequire struct {
	Token  string    `json:"token"`
	Proof  ProofWork `json:"proofofwork,omitempty"`
	Arkose struct {
		Required bool   `json:"required"`
		DX       string `json:"dx,omitempty"`
	} `json:"arkose"`
}

func CheckRequire

func CheckRequire(access_token string, deviceId string) *ChatRequire

type Content

type Content struct {
	ContentType string        `json:"content_type"`
	Parts       []interface{} `json:"parts"`
}

type CreateConversationRequest

type CreateConversationRequest struct {
	Action                     string    `json:"action"`
	Messages                   []Message `json:"messages,omitempty"`
	Model                      string    `json:"model"`
	ParentMessageID            string    `json:"parent_message_id,omitempty"`
	ConversationID             string    `json:"conversation_id,omitempty"`
	PluginIDs                  []string  `json:"plugin_ids"`
	TimezoneOffsetMin          int       `json:"timezone_offset_min"`
	ArkoseToken                string    `json:"arkose_token"`
	HistoryAndTrainingDisabled bool      `json:"history_and_training_disabled"`
	AutoContinue               bool      `json:"auto_continue"`
	Suggestions                []string  `json:"suggestions"`
}

func (*CreateConversationRequest) AddMessage

func (c *CreateConversationRequest) AddMessage(role string, content string)

type CreateConversationResponse

type CreateConversationResponse struct {
	Message struct {
		ID     string `json:"id"`
		Author struct {
			Role     string      `json:"role"`
			Name     interface{} `json:"name"`
			Metadata struct {
			} `json:"metadata"`
		} `json:"author"`
		CreateTime float64     `json:"create_time"`
		UpdateTime interface{} `json:"update_time"`
		Content    struct {
			ContentType string   `json:"content_type"`
			Parts       []string `json:"parts"`
		} `json:"content"`
		Status   string  `json:"status"`
		EndTurn  bool    `json:"end_turn"`
		Weight   float64 `json:"weight"`
		Metadata struct {
			MessageType   string `json:"message_type"`
			ModelSlug     string `json:"model_slug"`
			FinishDetails struct {
				Type string `json:"type"`
			} `json:"finish_details"`
		} `json:"metadata"`
		Recipient string `json:"recipient"`
	} `json:"message"`
	ConversationID string      `json:"conversation_id"`
	Error          interface{} `json:"error"`
}

type DalleContent

type DalleContent struct {
	AssetPointer string `json:"asset_pointer"`
	Metadata     struct {
		Dalle struct {
			Prompt string `json:"prompt"`
		} `json:"dalle"`
	} `json:"metadata"`
}

type FileInfo

type FileInfo struct {
	DownloadURL string `json:"download_url"`
	Status      string `json:"status"`
}

type GetModelsResponse

type GetModelsResponse struct {
	Models []struct {
		Slug         string   `json:"slug"`
		MaxTokens    int      `json:"max_tokens"`
		Title        string   `json:"title"`
		Description  string   `json:"description"`
		Tags         []string `json:"tags"`
		Capabilities struct {
		} `json:"capabilities"`
		EnabledTools []string `json:"enabled_tools,omitempty"`
	} `json:"models"`
	Categories []struct {
		Category             string `json:"category"`
		HumanCategoryName    string `json:"human_category_name"`
		SubscriptionLevel    string `json:"subscription_level"`
		DefaultModel         string `json:"default_model"`
		CodeInterpreterModel string `json:"code_interpreter_model"`
		PluginsModel         string `json:"plugins_model"`
	} `json:"categories"`
}

type Message

type Message struct {
	Author   Author      `json:"author"`
	Content  Content     `json:"content"`
	ID       string      `json:"id"`
	Metadata interface{} `json:"metadata"`
}

type ProofWork

type ProofWork struct {
	Difficulty string `json:"difficulty,omitempty"`
	Required   bool   `json:"required"`
	Seed       string `json:"seed,omitempty"`
}

type WSSMsgResponse

type WSSMsgResponse struct {
	SequenceId int                `json:"sequenceId"`
	Type       string             `json:"type"`
	From       string             `json:"from"`
	DataType   string             `json:"dataType"`
	Data       WSSMsgResponseData `json:"data"`
}

type WSSMsgResponseData

type WSSMsgResponseData struct {
	Type           string `json:"type"`
	Body           string `json:"body"`
	MoreBody       bool   `json:"more_body"`
	ResponseId     string `json:"response_id"`
	ConversationId string `json:"conversation_id"`
}

type WSSSequenceAckMessage

type WSSSequenceAckMessage struct {
	Type       string `json:"type"`
	SequenceId int    `json:"sequenceId"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL