Documentation ¶
Index ¶
- Constants
- Variables
- func FormatJsonBArrayToWhereInSQL(fields string, arrayValues []string) (sqlWhere string)
- func GenerateId() string
- func GetAllList(db *gorm.DB, conditions *map[string]interface{}, items interface{}, ...) (err error)
- func GetFirst(db *gorm.DB, conditions *map[string]interface{}, model interface{}, ...) (err error)
- func GetModelFieldValues(model interface{}) (mapFields *object.HashMap, err error)
- func GetModelFields(model interface{}) (fields []string)
- func GetTableFullName(schema string, prefix string, tableName string) (fullName string)
- func InsertModelsOnUniqueID(db *gorm.DB, mdl interface{}, uniqueName string, models interface{}) error
- func IsPowerPivotLoaded(mdl ModelInterface) bool
- func IsRobotModelLoaded(mdl ModelInterface) bool
- func Paginate(page int, pageSize int) func(db *gorm.DB) *gorm.DB
- func UpsertModelsOnUniqueID(db *gorm.DB, mdl interface{}, uniqueName string, models interface{}, ...) error
- func WhereAccountUuid(uuid string) func(db *gorm.DB) *gorm.DB
- func WhereUuid(uuid string) func(db *gorm.DB) *gorm.DB
- type Author
- type Content
- type Conversation
- type ConversationStatus
- type ErrReply
- type HandleError
- type HandlePostReply
- type HandlePreSend
- type Job
- type Lora
- type Message
- type MessageType
- type MetaData
- type ModelInterface
- type Pagination
- func (p *Pagination) GetLimit() int
- func (p *Pagination) GetOffset() int
- func (p *Pagination) GetPage() int
- func (p *Pagination) GetSort() string
- func (p *Pagination) SetLimit(limit int) *Pagination
- func (p *Pagination) SetPage(page int) *Pagination
- func (p *Pagination) SetSort(sort string) *Pagination
- type PowerUuidModel
- func (mdl *PowerUuidModel) GetForeignRefer() string
- func (mdl *PowerUuidModel) GetForeignReferValue() int64
- func (mdl *PowerUuidModel) GetId() int64
- func (mdl *PowerUuidModel) GetPrimaryKey() string
- func (mdl *PowerUuidModel) GetRobotModel() ModelInterface
- func (mdl *PowerUuidModel) GetTableName(needFull bool) string
- func (mdl *PowerUuidModel) GetUuid() string
- type RobotAttributes
- type RobotGender
- type RobotModel
- func (mdl *RobotModel) GetForeignRefer() string
- func (mdl *RobotModel) GetForeignReferValue() int64
- func (mdl *RobotModel) GetId() int64
- func (mdl *RobotModel) GetPrimaryKey() string
- func (mdl *RobotModel) GetRobotModel() ModelInterface
- func (mdl *RobotModel) GetTableName(needFull bool) string
- func (mdl *RobotModel) GetUuid() string
- type RobotType
- type Role
- type Session
Constants ¶
View Source
const DefaultPageSize = 10
View Source
const MaxPageSize = 999
View Source
const ModelStatusActive int8 = 1
View Source
const ModelStatusCanceled int8 = 2
View Source
const ModelStatusDraft int8 = 0
View Source
const ModelStatusInactive int8 = 4
View Source
const ModelStatusPending int8 = 3
View Source
const PageDefaultSize = 20
View Source
const UniqueId = "id"
View Source
const UniqueUuid = "uuid"
Variables ¶
View Source
var ArrayModelFields *object.HashMap = &object.HashMap{}
View Source
var TablePrefix string
Functions ¶
func FormatJsonBArrayToWhereInSQL ¶
---------------------------------------------------------------------------------------------------------------------
func GenerateId ¶
func GenerateId() string
func GetAllList ¶
func GetModelFieldValues ¶
func GetModelFields ¶
func GetModelFields(model interface{}) (fields []string)
func GetTableFullName ¶
func InsertModelsOnUniqueID ¶
func IsPowerPivotLoaded ¶
func IsPowerPivotLoaded(mdl ModelInterface) bool
func IsRobotModelLoaded ¶
func IsRobotModelLoaded(mdl ModelInterface) bool
func UpsertModelsOnUniqueID ¶
Types ¶
type Conversation ¶
type Conversation struct { ID string UserID string Action string Sessions []*Session ParentMessageID string Model string StartTime time.Time EndTime time.Time Status ConversationStatus }
func NewConversation ¶
func NewConversation(userId string) *Conversation
func (*Conversation) AddSession ¶
func (c *Conversation) AddSession(ctx context.Context) (session *Session, index int)
func (*Conversation) IsActive ¶
func (c *Conversation) IsActive() bool
type ConversationStatus ¶
type ConversationStatus string
const ( ConversationStatusActive ConversationStatus = "active" ConversationStatusInactive ConversationStatus = "inactive" ConversationStatusClosed ConversationStatus = "closed" )
type HandleError ¶
type HandleError func(reply *ErrReply)
type HandlePreSend ¶
Middleware 是中间件函数的类型定义
type Lora ¶
type Lora struct { database.PowerModel Preview string `gorm:"comment:预览图" json:"preview"` Hash string `gorm:"comment:Hash" json:"hash"` Alias string `gorm:"comment:别名" json:"alias"` Name string `gorm:"comment:名称" json:"name"` Path string `gorm:"comment:路径" json:"path"` MetaData datatypes.JSON `gorm:"comment:元数据" json:"metadata"` }
type Message ¶
type Message struct { RobotModel ModelType string `gorm:"comment:模型类型" json:"modelType"` MessageType MessageType `gorm:"comment:消息类型" json:"messageType"` Author string `gorm:"comment:作者" json:"author"` Content datatypes.JSON `gorm:"comment:内容" json:"content"` Metadata MetaData `gorm:"comment:meta" json:"metadata"` }
Message 是消息的结构定义
func CopyMessage ¶
func NewMessage ¶
func NewMessage(msgType MessageType) *Message
type MessageType ¶
type MessageType int
MessageType 是消息类型的枚举定义
const ( TextMessage MessageType = iota ImageMessage AudioMessage )
type MetaData ¶
type MetaData struct { ErrMsg string `json:"errMsg"` ErrCode int `json:"errorCode"` Robot *RobotAttributes `json:"robot"` Conversation *Conversation `json:"conversation"` CustomerId int64 `json:"customerId"` // 用来保存请问的原始数据,但是不用包含输入的图片 RequestData datatypes.JSON `json:"requestData"` }
type ModelInterface ¶
type Pagination ¶
type Pagination struct { Limit int `json:"limit"` Page int `json:"page"` Sort string `json:"sort"` TotalRows int64 `json:"totalRows"` TotalPages int `json:"totalPages"` Data interface{} `json:"data"` }
func NewPagination ¶
func NewPagination(page int, limit int, sort string) *Pagination
func (*Pagination) GetLimit ¶
func (p *Pagination) GetLimit() int
func (*Pagination) GetOffset ¶
func (p *Pagination) GetOffset() int
func (*Pagination) GetPage ¶
func (p *Pagination) GetPage() int
func (*Pagination) GetSort ¶
func (p *Pagination) GetSort() string
func (*Pagination) SetLimit ¶
func (p *Pagination) SetLimit(limit int) *Pagination
func (*Pagination) SetPage ¶
func (p *Pagination) SetPage(page int) *Pagination
func (*Pagination) SetSort ¶
func (p *Pagination) SetSort(sort string) *Pagination
type PowerUuidModel ¶
type PowerUuidModel struct { Id int64 `gorm:"autoIncrement:true;unique; column:id; ->;<-:create" json:"-"` Uuid string `gorm:"primaryKey;autoIncrement:false;unique; column:uuid; ->;<-:create " json:"uuid" sql:"index"` CreatedAt time.Time `gorm:"column:created_at; ->;<-:create " json:"createdAt"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index"` }
func NewPowerUuidModel ¶
func NewPowerUuidModel() *PowerUuidModel
func (*PowerUuidModel) GetForeignRefer ¶
func (mdl *PowerUuidModel) GetForeignRefer() string
func (*PowerUuidModel) GetForeignReferValue ¶
func (mdl *PowerUuidModel) GetForeignReferValue() int64
func (*PowerUuidModel) GetId ¶
func (mdl *PowerUuidModel) GetId() int64
func (*PowerUuidModel) GetPrimaryKey ¶
func (mdl *PowerUuidModel) GetPrimaryKey() string
func (*PowerUuidModel) GetRobotModel ¶
func (mdl *PowerUuidModel) GetRobotModel() ModelInterface
func (*PowerUuidModel) GetTableName ¶
func (mdl *PowerUuidModel) GetTableName(needFull bool) string
func (*PowerUuidModel) GetUuid ¶
func (mdl *PowerUuidModel) GetUuid() string
type RobotAttributes ¶
type RobotAttributes struct { // attributes Name string Version string Gender RobotGender Type RobotType }
type RobotGender ¶
type RobotGender int8
const ( GenderMale RobotGender = iota GenderFemale GenderNeutral )
type RobotModel ¶
type RobotModel struct { Id int64 `gorm:"autoIncrement:true;unique; column:id; ->;<-:create" json:"id"` CreatedAt time.Time `gorm:"column:created_at; ->;<-:create " json:"createdAt"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index"` }
func NewRobotModel ¶
func NewRobotModel() *RobotModel
func (*RobotModel) GetForeignRefer ¶
func (mdl *RobotModel) GetForeignRefer() string
func (*RobotModel) GetForeignReferValue ¶
func (mdl *RobotModel) GetForeignReferValue() int64
func (*RobotModel) GetId ¶
func (mdl *RobotModel) GetId() int64
func (*RobotModel) GetPrimaryKey ¶
func (mdl *RobotModel) GetPrimaryKey() string
func (*RobotModel) GetRobotModel ¶
func (mdl *RobotModel) GetRobotModel() ModelInterface
func (*RobotModel) GetTableName ¶
func (mdl *RobotModel) GetTableName(needFull bool) string
func (*RobotModel) GetUuid ¶
func (mdl *RobotModel) GetUuid() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.