do

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_COLLECTION    = "user"
	ACCOUNT_COLLECTION = "account"
)
View Source
const (
	APP_COLLECTION = "app"
)
View Source
const (
	CHAT_COLLECTION = "chat"
)
View Source
const (
	KEY_COLLECTION = "key"
)
View Source
const (
	MODEL_AGENT_COLLECTION = "model_agent"
)
View Source
const (
	MODEL_COLLECTION = "model"
)
View Source
const (
	SYS_ADMIN_COLLECTION = "sys_admin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	gmeta.Meta `collection:"account" bson:"-"`
	Id         string `bson:"_id,omitempty"`        // ID
	Uid        string `bson:"uid,omitempty"`        // 用户主键ID
	UserId     int    `bson:"user_id,omitempty"`    // 用户ID
	Account    string `bson:"account,omitempty"`    // 账号
	Password   string `bson:"password,omitempty"`   // 密码
	Salt       string `bson:"salt,omitempty"`       // 盐
	LoginIP    string `bson:"login_ip,omitempty"`   // 登录IP
	LoginTime  int64  `bson:"login_time,omitempty"` // 登录时间
	Remark     string `bson:"remark,omitempty"`     // 备注
	Status     int    `bson:"status,omitempty"`     // 状态[1:正常, 2:禁用, -1:删除]
	Creator    string `bson:"creator,omitempty"`    // 创建人
	Updater    string `bson:"updater,omitempty"`    // 更新人
	CreatedAt  int64  `bson:"created_at,omitempty"` // 创建时间
	UpdatedAt  int64  `bson:"updated_at,omitempty"` // 更新时间
}

type App

type App struct {
	gmeta.Meta   `collection:"app" bson:"-"`
	AppId        int      `bson:"app_id,omitempty"`     // 应用ID
	Name         string   `bson:"name,omitempty"`       // 应用名称
	Type         int      `bson:"type,omitempty"`       // 应用类型
	Models       []string `bson:"models"`               // 模型权限
	IsLimitQuota bool     `bson:"is_limit_quota"`       // 是否限制额度
	Quota        int      `bson:"quota"`                // 额度
	RPM          int      `bson:"rpm,omitempty"`        // 每分钟请求数
	RPD          int      `bson:"rpd,omitempty"`        // 每天的请求数
	IpWhitelist  []string `bson:"ip_whitelist"`         // IP白名单
	IpBlacklist  []string `bson:"ip_blacklist"`         // IP黑名单
	Remark       string   `bson:"remark"`               // 备注
	Status       int      `bson:"status,omitempty"`     // 状态[1:正常, 2:禁用, -1:删除]
	UserId       int      `bson:"user_id,omitempty"`    // 用户ID
	Creator      string   `bson:"creator,omitempty"`    // 创建人
	Updater      string   `bson:"updater,omitempty"`    // 更新人
	CreatedAt    int64    `bson:"created_at,omitempty"` // 创建时间
	UpdatedAt    int64    `bson:"updated_at,omitempty"` // 更新时间
}

type Chat

type Chat struct {
	gmeta.Meta         `collection:"chat" bson:"-"`
	TraceId            string      `bson:"trace_id,omitempty"`              // 日志ID
	UserId             int         `bson:"user_id,omitempty"`               // 用户ID
	AppId              int         `bson:"app_id,omitempty"`                // 应用ID
	Corp               string      `bson:"corp,omitempty"`                  // 公司[OpenAI;Baidu;Xfyun;Aliyun;Midjourney]
	ModelId            string      `bson:"model_id,omitempty"`              // 模型ID
	Name               string      `bson:"name,omitempty"`                  // 模型名称
	Model              string      `bson:"model,omitempty"`                 // 模型
	Type               int         `bson:"type,omitempty"`                  // 模型类型[1:文生文, 2:文生图, 3:图生文, 4:图生图, 5:文生语音, 6:语音生文]
	Key                string      `bson:"key,omitempty"`                   // 密钥
	IsEnableModelAgent bool        `bson:"is_enable_model_agent,omitempty"` // 是否启用模型代理
	ModelAgentId       string      `bson:"model_agent_id,omitempty"`        // 模型代理ID
	ModelAgent         *ModelAgent `bson:"model_agent,omitempty"`           // 模型代理信息
	Proxy              string      `bson:"proxy,omitempty"`                 // 代理
	Stream             bool        `bson:"stream,omitempty"`                // 是否流式
	Messages           []Message   `bson:"messages,omitempty"`              // 完整提示(提问)
	Prompt             string      `bson:"prompt,omitempty"`                // 提示(提问)
	Completion         string      `bson:"completion,omitempty"`            // 补全(回答)
	PromptRatio        float64     `bson:"prompt_ratio,omitempty"`          // 提示倍率(提问倍率)
	CompletionRatio    float64     `bson:"completion_ratio,omitempty"`      // 补全倍率(回答倍率)
	PromptTokens       int         `bson:"prompt_tokens,omitempty"`         // 提示令牌数(提问令牌数)
	CompletionTokens   int         `bson:"completion_tokens,omitempty"`     // 补全令牌数(回答令牌数)
	TotalTokens        int         `bson:"total_tokens,omitempty"`          // 总令牌数
	ConnTime           int64       `bson:"conn_time,omitempty"`             // 连接时间
	Duration           int64       `bson:"duration,omitempty"`              // 持续时间
	TotalTime          int64       `bson:"total_time,omitempty"`            // 总时间
	InternalTime       int64       `bson:"internal_time,omitempty"`         // 内耗时间
	ReqTime            int64       `bson:"req_time,omitempty"`              // 请求时间
	ReqDate            string      `bson:"req_date,omitempty"`              // 请求日期
	ClientIp           string      `bson:"client_ip,omitempty"`             // 客户端IP
	RemoteIp           string      `bson:"remote_ip,omitempty"`             // 远程IP
	ErrMsg             string      `bson:"err_msg,omitempty"`               // 错误信息
	Status             int         `bson:"status,omitempty"`                // 状态[1:成功, -1:失败]
	Creator            string      `bson:"creator,omitempty"`               // 创建人
	Updater            string      `bson:"updater,omitempty"`               // 更新人
	CreatedAt          int64       `bson:"created_at,omitempty"`            // 创建时间
	UpdatedAt          int64       `bson:"updated_at,omitempty"`            // 更新时间
}

type Key

type Key struct {
	gmeta.Meta   `collection:"key" bson:"-"`
	UserId       int      `bson:"user_id,omitempty"`    // 用户ID
	AppId        int      `bson:"app_id,omitempty"`     // 应用ID
	Corp         string   `bson:"corp,omitempty"`       // 公司[OpenAI;Baidu;Xfyun;Aliyun;Midjourney]
	Key          string   `bson:"key,omitempty"`        // 密钥
	Type         int      `bson:"type,omitempty"`       // 密钥类型[1:应用, 2:模型]
	Models       []string `bson:"models"`               // 模型
	ModelAgents  []string `bson:"model_agents"`         // 模型代理
	IsAgentsOnly bool     `bson:"is_agents_only"`       // 是否代理专用
	IsLimitQuota bool     `bson:"is_limit_quota"`       // 是否限制额度
	Quota        int      `bson:"quota"`                // 额度
	RPM          int      `bson:"rpm,omitempty"`        // 每分钟请求数
	RPD          int      `bson:"rpd,omitempty"`        // 每天的请求数
	IpWhitelist  []string `bson:"ip_whitelist"`         // IP白名单
	IpBlacklist  []string `bson:"ip_blacklist"`         // IP黑名单
	Remark       string   `bson:"remark"`               // 备注
	Status       int      `bson:"status,omitempty"`     // 状态[1:正常, 2:禁用, -1:删除]
	Creator      string   `bson:"creator,omitempty"`    // 创建人
	Updater      string   `bson:"updater,omitempty"`    // 更新人
	CreatedAt    int64    `bson:"created_at,omitempty"` // 创建时间
	UpdatedAt    int64    `bson:"updated_at,omitempty"` // 更新时间
}

type Message

type Message struct {
	Role    string `bson:"role,omitempty"`    // 角色
	Content string `bson:"content,omitempty"` // 内容
}

type Model

type Model struct {
	gmeta.Meta         `collection:"model" bson:"-"`
	Corp               string   `bson:"corp,omitempty"`             // 公司[OpenAI;Baidu;Xfyun;Aliyun;Midjourney]
	Name               string   `bson:"name,omitempty"`             // 模型名称
	Model              string   `bson:"model,omitempty"`            // 模型
	Type               int      `bson:"type,omitempty"`             // 模型类型[1:文生文, 2:文生图, 3:图生文, 4:图生图, 5:文生语音, 6:语音生文]
	PromptRatio        float64  `bson:"prompt_ratio,omitempty"`     // 提示倍率(提问倍率)
	CompletionRatio    float64  `bson:"completion_ratio,omitempty"` // 补全倍率(回答倍率)
	DataFormat         int      `bson:"data_format,omitempty"`      // 数据格式[1:统一格式, 2:官方格式]
	IsPublic           bool     `bson:"is_public"`                  // 是否公开
	IsEnableModelAgent bool     `bson:"is_enable_model_agent"`      // 是否启用模型代理
	ModelAgents        []string `bson:"model_agents"`               // 模型代理
	Remark             string   `bson:"remark"`                     // 备注
	Status             int      `bson:"status,omitempty"`           // 状态[1:正常, 2:禁用, -1:删除]
	Creator            string   `bson:"creator,omitempty"`          // 创建人
	Updater            string   `bson:"updater,omitempty"`          // 更新人
	CreatedAt          int64    `bson:"created_at,omitempty"`       // 创建时间
	UpdatedAt          int64    `bson:"updated_at,omitempty"`       // 更新时间
}

type ModelAgent

type ModelAgent struct {
	gmeta.Meta `collection:"model_agent" bson:"-"`
	Name       string `bson:"name,omitempty"`       // 模型代理名称
	BaseUrl    string `bson:"base_url,omitempty"`   // 模型代理地址
	Path       string `bson:"path"`                 // 模型代理地址路径
	Weight     int    `bson:"weight"`               // 权重
	Remark     string `bson:"remark"`               // 备注
	Status     int    `bson:"status,omitempty"`     // 状态[1:正常, 2:禁用, -1:删除]
	Creator    string `bson:"creator,omitempty"`    // 创建人
	Updater    string `bson:"updater,omitempty"`    // 更新人
	CreatedAt  int64  `bson:"created_at,omitempty"` // 创建时间
	UpdatedAt  int64  `bson:"updated_at,omitempty"` // 更新时间
}

type SysAdmin

type SysAdmin struct {
	gmeta.Meta `collection:"sys_admin" bson:"-"`
	Id         string `bson:"_id,omitempty"`        // ID
	UserId     int    `bson:"user_id,omitempty"`    // 用户ID
	Name       string `bson:"name,omitempty"`       // 姓名
	Avatar     string `bson:"avatar,omitempty"`     // 头像
	Email      string `bson:"email,omitempty"`      // 邮箱
	Phone      string `bson:"phone,omitempty"`      // 手机号
	Account    string `bson:"account,omitempty"`    // 账号
	Password   string `bson:"password,omitempty"`   // 密码
	Salt       string `bson:"salt,omitempty"`       // 盐
	LoginIP    string `bson:"login_ip,omitempty"`   // 登录IP
	LoginTime  int64  `bson:"login_time,omitempty"` // 登录时间
	Remark     string `bson:"remark,omitempty"`     // 备注
	Status     int    `bson:"status,omitempty"`     // 状态[1:正常, 2:禁用, -1:删除]
	Creator    string `bson:"creator,omitempty"`    // 创建人
	Updater    string `bson:"updater,omitempty"`    // 更新人
	CreatedAt  int64  `bson:"created_at,omitempty"` // 创建时间
	UpdatedAt  int64  `bson:"updated_at,omitempty"` // 更新时间
}

type User

type User struct {
	gmeta.Meta `collection:"user" bson:"-"`
	Id         string   `bson:"_id,omitempty"`        // ID
	UserId     int      `bson:"user_id,omitempty"`    // 用户ID
	Name       string   `bson:"name,omitempty"`       // 姓名
	Avatar     string   `bson:"avatar,omitempty"`     // 头像
	Email      string   `bson:"email,omitempty"`      // 邮箱
	Phone      string   `bson:"phone,omitempty"`      // 手机号
	VipLevel   int      `bson:"vip_level,omitempty"`  // 会员等级
	Quota      int      `bson:"quota"`                // 额度
	Models     []string `bson:"models"`               // 模型权限
	Remark     string   `bson:"remark,omitempty"`     // 备注
	Status     int      `bson:"status,omitempty"`     // 状态[1:正常, 2:禁用, -1:删除]
	Creator    string   `bson:"creator,omitempty"`    // 创建人
	Updater    string   `bson:"updater,omitempty"`    // 更新人
	CreatedAt  int64    `bson:"created_at,omitempty"` // 创建时间
	UpdatedAt  int64    `bson:"updated_at,omitempty"` // 更新时间
}

Jump to

Keyboard shortcuts

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