Documentation
¶
Index ¶
- func RegisterAdminUser(i IAdminUser)
- func RegisterApp(i IApp)
- func RegisterAudio(i IAudio)
- func RegisterAuth(i IAuth)
- func RegisterChat(i IChat)
- func RegisterCommon(i ICommon)
- func RegisterCorp(i ICorp)
- func RegisterDashboard(i IDashboard)
- func RegisterFinance(i IFinance)
- func RegisterImage(i IImage)
- func RegisterKey(i IKey)
- func RegisterMidjourney(i IMidjourney)
- func RegisterModel(i IModel)
- func RegisterModelAgent(i IModelAgent)
- func RegisterSession(i ISession)
- func RegisterSiteConfig(i ISiteConfig)
- func RegisterStatistics(i IStatistics)
- func RegisterSysAdmin(i ISysAdmin)
- func RegisterUser(i IUser)
- type IAdminUser
- type IApp
- type IAudio
- type IAuth
- type IChat
- type ICommon
- type ICorp
- type IDashboard
- type IFinance
- type IImage
- type IKey
- type IMidjourney
- type IModel
- type IModelAgent
- type ISession
- type ISiteConfig
- type IStatistics
- type ISysAdmin
- type IUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAdminUser ¶
func RegisterAdminUser(i IAdminUser)
func RegisterApp ¶
func RegisterApp(i IApp)
func RegisterAudio ¶ added in v0.5.0
func RegisterAudio(i IAudio)
func RegisterAuth ¶
func RegisterAuth(i IAuth)
func RegisterChat ¶
func RegisterChat(i IChat)
func RegisterCommon ¶
func RegisterCommon(i ICommon)
func RegisterCorp ¶ added in v0.3.0
func RegisterCorp(i ICorp)
func RegisterDashboard ¶
func RegisterDashboard(i IDashboard)
func RegisterFinance ¶ added in v0.4.0
func RegisterFinance(i IFinance)
func RegisterImage ¶ added in v0.4.0
func RegisterImage(i IImage)
func RegisterKey ¶
func RegisterKey(i IKey)
func RegisterMidjourney ¶ added in v0.4.0
func RegisterMidjourney(i IMidjourney)
func RegisterModel ¶
func RegisterModel(i IModel)
func RegisterModelAgent ¶
func RegisterModelAgent(i IModelAgent)
func RegisterSession ¶
func RegisterSession(i ISession)
func RegisterSiteConfig ¶ added in v1.0.0
func RegisterSiteConfig(i ISiteConfig)
func RegisterStatistics ¶ added in v0.5.0
func RegisterStatistics(i IStatistics)
func RegisterSysAdmin ¶
func RegisterSysAdmin(i ISysAdmin)
func RegisterUser ¶
func RegisterUser(i IUser)
Types ¶
type IAdminUser ¶
type IAdminUser interface {
// 新建用户
Create(ctx context.Context, params model.UserCreateReq) error
// 更新用户
Update(ctx context.Context, params model.UserUpdateReq) error
// 更改用户额度过期时间
ChangeQuotaExpire(ctx context.Context, params model.UserChangeQuotaExpireReq) error
// 更改用户状态
ChangeStatus(ctx context.Context, params model.UserChangeStatusReq) error
// 删除用户
Delete(ctx context.Context, id string) error
// 用户详情
Detail(ctx context.Context, id string) (*model.User, error)
// 用户分页列表
Page(ctx context.Context, params model.UserPageReq) (*model.UserPageRes, error)
// 用户列表
List(ctx context.Context, params model.UserListReq) ([]*model.User, error)
// 授予用户额度
GrantQuota(ctx context.Context, params model.UserGrantQuotaReq) error
// 用户模型权限
Models(ctx context.Context, params model.UserModelsReq) error
}
func AdminUser ¶
func AdminUser() IAdminUser
type IApp ¶
type IApp interface {
// 新建应用
Create(ctx context.Context, params model.AppCreateReq) (string, error)
// 更新应用
Update(ctx context.Context, params model.AppUpdateReq) error
// 更改应用状态
ChangeStatus(ctx context.Context, params model.AppChangeStatusReq) error
// 删除应用
Delete(ctx context.Context, id string) error
// 应用详情
Detail(ctx context.Context, id string) (*model.App, error)
// 应用分页列表
Page(ctx context.Context, params model.AppPageReq) (*model.AppPageRes, error)
// 应用列表
List(ctx context.Context, params model.AppListReq) ([]*model.App, error)
// 新建应用密钥
CreateKey(ctx context.Context, params model.AppCreateKeyReq) (string, error)
// 应用密钥配置
KeyConfig(ctx context.Context, params model.AppKeyConfigReq) (k string, err error)
// 应用模型权限
Models(ctx context.Context, params model.AppModelsReq) error
}
type IAudio ¶ added in v0.5.0
type IAuth ¶
type IAuth interface {
// 身份核验
Authenticator(ctx context.Context, req interface{}) bool
// 注册接口
Register(ctx context.Context, params model.RegisterReq, channel ...string) error
// 登录接口
Login(ctx context.Context, params model.LoginReq) (res *model.LoginRes, err error)
// 退出登录接口
Logout(ctx context.Context) error
// 账号找回接口
Forget(ctx context.Context, params model.ForgetReq) error
// 生成用户Token
GenUserToken(ctx context.Context, user *model.User, isSaveSession bool) (token string, err error)
// 根据Token获取用户信息
GetUserByToken(ctx context.Context, token string) (*model.User, error)
// 生成管理员Token
GenAdminToken(ctx context.Context, admin *model.SysAdmin, isSaveSession bool) (token string, err error)
// 根据Token获取管理员信息
GetAdminByToken(ctx context.Context, token string) (*model.SysAdmin, error)
}
type IChat ¶
type IChat interface {
// 聊天日志详情
Detail(ctx context.Context, id string) (*model.Chat, error)
// 聊天日志分页列表
Page(ctx context.Context, params model.ChatPageReq) (*model.ChatPageRes, error)
// 聊天导出
Export(ctx context.Context, params model.ChatExportReq) (string, error)
// 聊天批量操作
BatchOperate(ctx context.Context, params model.ChatBatchOperateReq) error
// 聊天日志详情复制字段值
CopyField(ctx context.Context, params model.ChatCopyFieldReq) (string, error)
}
type ICommon ¶
type ICommon interface {
// 发送邮件验证码
EmailCode(ctx context.Context, params model.SendEmailReq) (*model.SendEmailRes, error)
// 发送短信验证码
SmsCode(ctx context.Context, params model.SendSmsReq) (*model.SendSmsRes, error)
// 缓存验证码
SetCode(ctx context.Context, channel string, account string, code string, exp time.Duration) error
// 获取验证码
GetCode(ctx context.Context, channel string, account string) (string, error)
// 删除验证码
DelCode(ctx context.Context, channel string, account string) error
// 校验验证码
VerifyCode(ctx context.Context, channel string, account string, code string) (pass bool)
// 解析密钥
ParseSecretKey(ctx context.Context, secretKey string) (int, int, error)
}
type ICorp ¶ added in v0.3.0
type ICorp interface {
// 新建公司
Create(ctx context.Context, params model.CorpCreateReq) (string, error)
// 更新公司
Update(ctx context.Context, params model.CorpUpdateReq) error
// 更改公司公开状态
ChangePublic(ctx context.Context, params model.CorpChangePublicReq) error
// 更改公司状态
ChangeStatus(ctx context.Context, params model.CorpChangeStatusReq) error
// 删除公司
Delete(ctx context.Context, id string) error
// 公司详情
Detail(ctx context.Context, id string) (*model.Corp, error)
// 公司分页列表
Page(ctx context.Context, params model.CorpPageReq) (*model.CorpPageRes, error)
// 公司列表
List(ctx context.Context, params model.CorpListReq) ([]*model.Corp, error)
// 公司批量操作
BatchOperate(ctx context.Context, params model.CorpBatchOperateReq) error
}
type IDashboard ¶
type IDashboard interface {
// 基础数据
BaseData(ctx context.Context) (dashboard *model.Dashboard, err error)
// 调用数据
CallData(ctx context.Context, params model.DashboardCallDataReq) ([]*model.CallData, error)
// 费用
Expense(ctx context.Context) (*model.Expense, error)
// 数据TOP
DataTop(ctx context.Context, params model.DashboardDataTopReq) ([]*model.DataTop, error)
// 模型占比
ModelPercent(ctx context.Context, params model.DashboardModelPercentReq) ([]string, []*model.ModelPercent, error)
// 每秒钟数据
PerSecond(ctx context.Context, params model.DashboardPerSecondReq) (int, int, error)
// 每分钟数据
PerMinute(ctx context.Context, params model.DashboardPerMinuteReq) (int, int, error)
}
func Dashboard ¶
func Dashboard() IDashboard
type IFinance ¶ added in v0.4.0
type IFinance interface {
// 账单明细详情
BillDetail(ctx context.Context, id string) (*model.StatisticsUser, error)
// 账单明细分页列表
BillPage(ctx context.Context, params model.FinanceBillPageReq) (*model.FinanceBillPageRes, error)
// 账单明细导出
BillExport(ctx context.Context, params model.FinanceBillExportReq) (string, error)
// 交易记录分页列表
DealRecordPage(ctx context.Context, params model.FinanceDealRecordPageReq) (*model.FinanceDealRecordPageRes, error)
}
type IImage ¶ added in v0.4.0
type IKey ¶
type IKey interface {
// 新建密钥
Create(ctx context.Context, params model.KeyCreateReq, isModelAgent bool) error
// 更新密钥
Update(ctx context.Context, params model.KeyUpdateReq, isModelAgent bool) error
// 更改密钥状态
ChangeStatus(ctx context.Context, params model.KeyChangeStatusReq) error
// 删除密钥
Delete(ctx context.Context, id string) error
// 密钥详情
Detail(ctx context.Context, id string) (*model.Key, error)
// 密钥分页列表
Page(ctx context.Context, params model.KeyPageReq) (*model.KeyPageRes, error)
// 密钥列表
List(ctx context.Context, params model.KeyListReq) ([]*model.Key, error)
// 密钥批量操作
BatchOperate(ctx context.Context, params model.KeyBatchOperateReq) error
// 根据Keys查询密钥详情列表
DetailListByKey(ctx context.Context, keys []string) ([]*entity.Key, error)
// 密钥模型权限
Models(ctx context.Context, params model.KeyModelsReq) error
}
type IMidjourney ¶ added in v0.4.0
type IMidjourney interface {
// Midjourney详情
Detail(ctx context.Context, id string) (*model.Midjourney, error)
// Midjourney分页列表
Page(ctx context.Context, params model.MidjourneyPageReq) (*model.MidjourneyPageRes, error)
}
func Midjourney ¶ added in v0.4.0
func Midjourney() IMidjourney
type IModel ¶
type IModel interface {
// 新建模型
Create(ctx context.Context, params model.ModelCreateReq) error
// 更新模型
Update(ctx context.Context, params model.ModelUpdateReq) error
// 更改模型状态
ChangeStatus(ctx context.Context, params model.ModelChangeStatusReq) error
// 删除模型
Delete(ctx context.Context, id string) error
// 模型详情
Detail(ctx context.Context, id string) (*model.Model, error)
// 模型分页列表
Page(ctx context.Context, params model.ModelPageReq) (*model.ModelPageRes, error)
// 模型列表
List(ctx context.Context, params model.ModelListReq) ([]*model.Model, error)
// 模型批量操作
BatchOperate(ctx context.Context, params model.ModelBatchOperateReq) error
// 模型树
Tree(ctx context.Context, params model.ModelTreeReq) ([]*model.Tree, error)
// 模型权限列表
Permissions(ctx context.Context, params model.ModelPermissionsReq) ([]*model.Model, error)
// 模型初始化同步
InitSync(ctx context.Context, params model.ModelInitSyncReq) error
// 公开的模型Ids
PublicModels(ctx context.Context) ([]string, error)
// 根据模型Ids查询模型名称
ModelNames(ctx context.Context, models []string) ([]string, error)
// 模型名称是否存在
IsNameExist(ctx context.Context, name string, id ...string) bool
}
type IModelAgent ¶
type IModelAgent interface {
// 新建模型代理
Create(ctx context.Context, params model.ModelAgentCreateReq) (string, error)
// 更新模型代理
Update(ctx context.Context, params model.ModelAgentUpdateReq) error
// 更改模型代理状态
ChangeStatus(ctx context.Context, params model.ModelAgentChangeStatusReq) error
// 删除模型代理
Delete(ctx context.Context, id string) error
// 模型代理详情
Detail(ctx context.Context, id string) (*model.ModelAgent, error)
// 模型代理分页列表
Page(ctx context.Context, params model.ModelAgentPageReq) (*model.ModelAgentPageRes, error)
// 模型代理列表
List(ctx context.Context, params model.ModelAgentListReq) ([]*model.ModelAgent, error)
// 模型代理批量操作
BatchOperate(ctx context.Context, params model.ModelAgentBatchOperateReq) error
// 模型代理名称是否存在
IsNameExist(ctx context.Context, name string, id ...string) bool
}
func ModelAgent ¶
func ModelAgent() IModelAgent
type ISession ¶
type ISession interface {
// 保存用户会话信息
SaveUser(ctx context.Context, token string, user *model.User) error
// 保存管理员会话信息
SaveAdmin(ctx context.Context, token string, admin *model.SysAdmin) error
// 获取会话中Token
GetToken(ctx context.Context) string
// 获取会话中用户主键ID
GetUid(ctx context.Context) string
// 获取会话中UserId
GetUserId(ctx context.Context) int
// 获取会话中角色
GetRole(ctx context.Context) string
// 获取会话中创建人
GetCreator(ctx context.Context) string
// 获取会话中用户信息
GetUser(ctx context.Context) *model.User
// 获取会话中管理员信息
GetAdmin(ctx context.Context) *model.SysAdmin
// 判断获取会话中角色是否为用户
IsUserRole(ctx context.Context) bool
// 判断获取会话中角色是否为管理员
IsAdminRole(ctx context.Context) bool
// 更新用户会话信息
UpdateUserSession(ctx context.Context, user *model.User) error
// 更新管理员会话信息
UpdateAdminSession(ctx context.Context, admin *model.SysAdmin) error
}
type ISiteConfig ¶ added in v1.0.0
type ISiteConfig interface {
// 新建站点配置
Create(ctx context.Context, params model.SiteConfigCreateReq) error
// 更新站点配置
Update(ctx context.Context, params model.SiteConfigUpdateReq) error
// 更改站点配置状态
ChangeStatus(ctx context.Context, params model.SiteConfigChangeStatusReq) error
// 删除站点配置
Delete(ctx context.Context, id string) error
// 站点配置详情
Detail(ctx context.Context, params model.SiteConfigDetailReq) (*model.SiteConfig, error)
// 站点配置分页列表
Page(ctx context.Context, params model.SiteConfigPageReq) (*model.SiteConfigPageRes, error)
// 站点配置批量操作
BatchOperate(ctx context.Context, params model.SiteConfigBatchOperateReq) error
// 站点配置
Site(ctx context.Context, params model.SiteConfigDetailReq) *model.SiteConfig
// 根据域名获取站点配置
GetSiteConfigByDomain(ctx context.Context, domain string) *entity.SiteConfig
// 站点域名是否存在
IsDomainExist(ctx context.Context, domain string, id ...string) bool
}
func SiteConfig ¶ added in v1.0.0
func SiteConfig() ISiteConfig
type IStatistics ¶ added in v0.5.0
type IStatistics interface {
// 统计任务
StatisticsTask(ctx context.Context)
// 统计数据
StatisticsData(ctx context.Context, collection string, index string, lastTimeKey string, lastIdKey string)
}
func Statistics ¶ added in v0.5.0
func Statistics() IStatistics
type ISysAdmin ¶
type ISysAdmin interface {
// 管理员更新信息
UpdateInfo(ctx context.Context, params model.UserUpdateInfoReq) error
// 管理员修改密码
ChangePassword(ctx context.Context, params model.UserChangePasswordReq) (err error)
// 管理员修改邮箱
ChangeEmail(ctx context.Context, params model.UserChangeEmailReq) error
// 管理员更改头像
ChangeAvatar(ctx context.Context, file *ghttp.UploadFile) error
// 新建管理员
Create(ctx context.Context, params model.SysAdminCreateReq) error
// 更新管理员
Update(ctx context.Context, params model.SysAdminUpdateReq) error
// 删除管理员
Delete(ctx context.Context, id string) error
// 管理员详情
Detail(ctx context.Context, id string) (*model.SysAdmin, error)
// 管理员分页列表
Page(ctx context.Context, params model.SysAdminPageReq) (*model.SysAdminPageRes, error)
}
type IUser ¶
type IUser interface {
// 用户更新信息
UpdateInfo(ctx context.Context, params model.UserUpdateInfoReq) error
// 用户更改密码
ChangePassword(ctx context.Context, params model.UserChangePasswordReq) (err error)
// 用户更改邮箱
ChangeEmail(ctx context.Context, params model.UserChangeEmailReq) error
// 用户更改头像
ChangeAvatar(ctx context.Context, file *ghttp.UploadFile) error
// 根据userId获取用户信息
GetUserByUserId(ctx context.Context, userId int) (*model.User, error)
}
Click to show internal directories.
Click to hide internal directories.