Documentation ¶
Index ¶
- Constants
- Variables
- func GetImageGenerationPrice(size ImageSize) float64
- func GetModelThousandTokenPrice(_ GptModel) (prompt float64, answer float64)
- type ApiType
- type Client
- type Config
- type DrawCommand
- type GptCommand
- type GptCompletionsRequest
- type GptCompletionsResponse
- type GptConfigOptions
- type GptMessage
- type GptMessageChain
- func (chain *GptMessageChain) AddMessage(message GptMessage) *GptMessageChain
- func (chain *GptMessageChain) AddMessages(messages ...GptMessage) *GptMessageChain
- func (chain *GptMessageChain) GetMessages() []GptMessage
- func (chain *GptMessageChain) MergeChainAfter(another *GptMessageChain) *GptMessageChain
- func (chain *GptMessageChain) MergeChainBefore(another *GptMessageChain) *GptMessageChain
- type GptMessageRole
- type GptModel
- type GptReplyChoices
- type GptUsage
- type ImageGenerationRequest
- type ImageGenerationResponse
- type ImageGenerationResponseData
- type ImageSize
- type ManagementCommand
- type Permission
- type PermissionData
- type Plugin
Constants ¶
View Source
const ( PermissionNone = "none" PermissionChat = "chat" PermissionChatPlus = "chat+" PermissionImageSmall = "image-small" PermissionImageMedium = "image-medium" PermissionImageLarge = "image-large" PermissionImageMulti = "image-multi" )
Variables ¶
View Source
var ( SupportedGptModels = map[string]GptModel{ "gpt-3.5-turbo": Gpt3Dot5Turbo, "gpt-3.5-turbo-16k": Gpt3Dot5Turbo16K, "gpt-3.5-turbo-0613": Gpt3Dot5Turbo0613, "gpt-3.5-turbo-16k-0613": Gpt3Dot5Turbo16K0613, "gpt-4": Gpt4, "gpt-4-poe": Gpt4Poe, "gpt-4-0314": Gpt40314, "gpt-4-0613": Gpt40613, } SupportedImageSizes = map[ImageSize]string{ SizeSmall: "256x256", SizeMedium: "512x512", SizeLarge: "1024x1024", } )
View Source
var ( SupportedGptMessageRoles = map[string]GptMessageRole{ "user": RoleUser, "system": RoleSystem, "assistant": RoleAssistant, } )
Functions ¶
func GetImageGenerationPrice ¶
Types ¶
type Config ¶
type Config struct { BaseUrl string `yaml:"base_url"` ApiVersion string `yaml:"api_version"` AppToken string `yaml:"app_token"` Prompt string `yaml:"prompt"` Temperature float64 `yaml:"temperature"` PresencePenalty float64 `yaml:"presence_penalty"` FrequencyPenalty float64 `yaml:"frequency_penalty"` DefaultPermission []string `yaml:"default_permission"` }
type DrawCommand ¶
type DrawCommand struct {
plugin.ImageReplyCommand
}
func (DrawCommand) Description ¶
func (d DrawCommand) Description() string
func (DrawCommand) Example ¶
func (d DrawCommand) Example() string
func (DrawCommand) Handle ¶
func (d DrawCommand) Handle(payload processor.Payload) (replyMessage message.Message)
func (DrawCommand) Name ¶
func (d DrawCommand) Name() string
func (DrawCommand) Triggered ¶
func (d DrawCommand) Triggered(content string) (triggered bool)
type GptCommand ¶
type GptCommand struct {
plugin.TextReplyMessageBaseImplementation
}
func (GptCommand) Description ¶
func (g GptCommand) Description() string
func (GptCommand) Example ¶
func (g GptCommand) Example() string
func (GptCommand) Handle ¶
func (g GptCommand) Handle(payload processor.Payload) (replyMessage message.Message)
func (GptCommand) Name ¶
func (g GptCommand) Name() string
func (GptCommand) Triggered ¶
func (g GptCommand) Triggered(content string) (triggered bool)
type GptCompletionsRequest ¶
type GptCompletionsRequest struct { Model GptModel `json:"model"` Messages []GptMessage `json:"messages"` Temperature float64 `json:"temperature"` PresencePenalty float64 `json:"presence_penalty"` FrequencyPenalty float64 `json:"frequency_penalty"` TopP float64 `json:"top_p"` Stream bool `json:"stream"` }
func NewGptCompletionsRequest ¶
func NewGptCompletionsRequest(options GptConfigOptions, messages *GptMessageChain) GptCompletionsRequest
type GptCompletionsResponse ¶
type GptConfigOptions ¶
type GptMessage ¶
type GptMessage struct { Role GptMessageRole `json:"role"` Content string `json:"content"` }
type GptMessageChain ¶
type GptMessageChain struct {
// contains filtered or unexported fields
}
func NewGptMessage ¶
func NewGptMessage(message string, role GptMessageRole) *GptMessageChain
func NewGptMessageChain ¶
func NewGptMessageChain(messages ...GptMessage) *GptMessageChain
func NewGptMessageWithPrompt ¶
func NewGptMessageWithPrompt(prompt string, message string, role GptMessageRole) *GptMessageChain
func NewGptPrompt ¶
func NewGptPrompt(prompt string) *GptMessageChain
func (*GptMessageChain) AddMessage ¶
func (chain *GptMessageChain) AddMessage(message GptMessage) *GptMessageChain
func (*GptMessageChain) AddMessages ¶
func (chain *GptMessageChain) AddMessages(messages ...GptMessage) *GptMessageChain
func (*GptMessageChain) GetMessages ¶
func (chain *GptMessageChain) GetMessages() []GptMessage
func (*GptMessageChain) MergeChainAfter ¶
func (chain *GptMessageChain) MergeChainAfter(another *GptMessageChain) *GptMessageChain
func (*GptMessageChain) MergeChainBefore ¶
func (chain *GptMessageChain) MergeChainBefore(another *GptMessageChain) *GptMessageChain
type GptMessageRole ¶
type GptMessageRole string
const ( RoleUser GptMessageRole = "user" RoleSystem GptMessageRole = "system" RoleAssistant GptMessageRole = "assistant" )
type GptModel ¶
type GptModel string
const ( Gpt3Dot5Turbo GptModel = "gpt-3.5-turbo" Gpt3Dot5Turbo16K GptModel = "gpt-3.5-turbo-16k" Gpt3Dot5Turbo0613 GptModel = "gpt-3.5-turbo-0613" Gpt3Dot5Turbo16K0613 GptModel = "gpt-3.5-turbo-16k-0613" Gpt4 GptModel = "gpt-4" Gpt40314 GptModel = "gpt-4-0314" Gpt40613 GptModel = "gpt-4-0613" Gpt4Poe GptModel = "gpt-4-poe" )
type GptReplyChoices ¶
type GptReplyChoices struct { Index int `json:"index"` Message GptMessage `json:"message"` FinishReason string `json:"finish_reason"` }
type ImageGenerationRequest ¶
type ImageGenerationResponse ¶
type ImageGenerationResponse struct { Created uint64 `json:"created"` Data []ImageGenerationResponseData `json:"data"` }
type ManagementCommand ¶
type ManagementCommand struct {
plugin.TextReplyMessageBaseImplementation
}
func (ManagementCommand) Description ¶
func (m ManagementCommand) Description() string
func (ManagementCommand) Example ¶
func (m ManagementCommand) Example() string
func (ManagementCommand) Handle ¶
func (m ManagementCommand) Handle(payload processor.Payload) (replyMessage message.Message)
func (ManagementCommand) Name ¶
func (m ManagementCommand) Name() string
func (ManagementCommand) Triggered ¶
func (m ManagementCommand) Triggered(content string) (triggered bool)
type Permission ¶
type Permission struct { UserID string `gorm:"column:user_id;primaryKey;type:varchar(20)"` UserName string `gorm:"column:user_name;type:varchar(255)"` Permissions uint64 `gorm:"column:permissions;index"` }
func (Permission) TableName ¶
func (p Permission) TableName() string
type PermissionData ¶
type PermissionData uint64
func (PermissionData) AddPermission ¶
func (p PermissionData) AddPermission(permission PermissionData) PermissionData
func (PermissionData) AllPermissions ¶
func (p PermissionData) AllPermissions() []string
func (PermissionData) HasPermission ¶
func (p PermissionData) HasPermission(permission PermissionData) bool
func (PermissionData) RemovePermission ¶
func (p PermissionData) RemovePermission(permission PermissionData) PermissionData
Click to show internal directories.
Click to hide internal directories.