Documentation
¶
Index ¶
- Constants
- type AccountPayload
- type AccountService
- func (ac *AccountService) AccountProcess(ctx *gin.Context)
- func (ac *AccountService) AuthenticateUser(username, password string) int
- func (ac *AccountService) CheckUser(username string) (User, error)
- func (ac *AccountService) CreateUser(name, password string, cnt int64) error
- func (ac *AccountService) GetUser(username, password string) (User, error)
- func (ac *AccountService) GrantUser(username string, block int64) error
- func (ac *AccountService) IncBalance(username string, cnt int64) error
- func (ac *AccountService) IncUsage(username string, cnt int64) error
- func (ac *AccountService) ListUser() ([]User, error)
- func (ac *AccountService) UpdateUser(oldName, oldPassword, name, password string) error
- type ChatCompletionParams
- type ChatMessage
- type ChatMessageRequest
- type ChatMessageRequestOptions
- type ChatService
- type User
Constants ¶
View Source
const (
ChatPrimedTokens = 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountPayload ¶
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
func NewAccountService ¶
func NewAccountService(dsn string, basicUsers, baiscPasswords string) (*AccountService, error)
func (*AccountService) AccountProcess ¶
func (ac *AccountService) AccountProcess(ctx *gin.Context)
func (*AccountService) AuthenticateUser ¶
func (ac *AccountService) AuthenticateUser(username, password string) int
func (*AccountService) CheckUser ¶
func (ac *AccountService) CheckUser(username string) (User, error)
func (*AccountService) CreateUser ¶
func (ac *AccountService) CreateUser(name, password string, cnt int64) error
func (*AccountService) GetUser ¶
func (ac *AccountService) GetUser(username, password string) (User, error)
func (*AccountService) GrantUser ¶
func (ac *AccountService) GrantUser(username string, block int64) error
func (*AccountService) IncBalance ¶
func (ac *AccountService) IncBalance(username string, cnt int64) error
func (*AccountService) IncUsage ¶
func (ac *AccountService) IncUsage(username string, cnt int64) error
func (*AccountService) ListUser ¶
func (ac *AccountService) ListUser() ([]User, error)
func (*AccountService) UpdateUser ¶
func (ac *AccountService) UpdateUser(oldName, oldPassword, name, password string) error
type ChatCompletionParams ¶
type ChatCompletionParams struct { Model string `json:"model"` MaxTokens int `json:"max_tokens,omitempty"` Temperature float32 `json:"temperature,omitempty"` PresencePenalty float32 `json:"presence_penalty,omitempty"` FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` ChatSessionTTL time.Duration `json:"chat_session_ttl"` ChatMinResponseTokens int `json:"chat_min_response_tokens"` }
type ChatMessage ¶
type ChatMessageRequest ¶
type ChatMessageRequest struct { Prompt string `json:"prompt"` Options ChatMessageRequestOptions `json:"options"` }
type ChatService ¶
type ChatService struct {
// contains filtered or unexported fields
}
func NewChatService ¶
func NewChatService(apiKey string, baseURL string, socksProxy string, params ChatCompletionParams, account *AccountService) (*ChatService, error)
func (*ChatService) ChatProcess ¶
func (chat *ChatService) ChatProcess(ctx *gin.Context)
func (*ChatService) MessageProcess ¶
func (chat *ChatService) MessageProcess(ctx *gin.Context)
type User ¶
type User struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement"` Username string `gorm:"column:username;not null;unique;index"` Password string `gorm:"column:password;not null;index"` Balance int64 `gorm:"column:balance;not null;default:0"` Usage int64 `gorm:"column:usage;not null;default:0"` Isblock int `gorm:"column:is_block;not null;default:0"` }
Click to show internal directories.
Click to hide internal directories.