Documentation
¶
Index ¶
- Constants
- Variables
- func CalcTokens(prompt string) int
- func NewError(code int, message string) error
- func TokensEndSubstr(prompt string, maxToken int) string
- func TokensStartSubstr(prompt string, maxToken int) string
- func WebLogin(email string, passwd string, proxy string) (string, error)
- type Billing
- type Chat
- type Error
- type Options
- type PartialResponse
Constants ¶
View Source
const ( BU = "https://chat.openai.com/backend-api" Gpt3Model = "text-davinci-002-render-sha" )
Variables ¶
View Source
var ( H = map[string]string{ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0", "Content-Type": "application/json; charset=utf-8", "Accept": "text/event-stream", } BillingURL = "https://api.openai.com/v1/dashboard/billing/subscription" )
Functions ¶
func TokensEndSubstr ¶ added in v1.0.1
尾部截取prompt
func TokensStartSubstr ¶ added in v1.0.1
头部截取prompt
Types ¶
type Billing ¶ added in v1.0.1
type Billing struct {
Soft float64 `json:"soft_limit_usd"`
Hard float64 `json:"hard_limit_usd"`
System float64 `json:"system_hard_limit_usd"`
}
余额
type Chat ¶
type PartialResponse ¶
type PartialResponse struct {
Error error
ConversationId string `json:"conversation_id"`
ResponseError interface{} `json:"error"`
Message struct {
Id string `json:"id"`
Status string `json:"status"`
Author struct {
Role string `json:"role"`
} `json:"author"`
Content struct {
ContentType string `json:"content_type"`
Parts []string `json:"parts"`
} `json:"content"`
} `json:"message"`
}
Click to show internal directories.
Click to hide internal directories.