Documentation
¶
Index ¶
Constants ¶
View Source
const ( SessionTable = "convo_session" SessionAlias = "cs" SessionLabel = "session" SessionTypID = "convoSession" )
consts of Session 会话
View Source
const ( MessageTable = "convo_message" MessageAlias = "cm" MessageLabel = "message" MessageTypID = "convoMessage" )
consts of Message 消息
View Source
const ( UserTable = "convo_user" UserAlias = "au" UserLabel = "user" UserTypID = "convoUser" )
consts of User 用户
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
comm.BaseModel `bun:"table:convo_message,alias:cm" json:"-"`
comm.DefaultModel
MessageBasic
comm.MetaField
} // @name convoMessage
Message 消息
func NewMessageWithBasic ¶
func NewMessageWithBasic(in MessageBasic) *Message
func NewMessageWithID ¶
func (*Message) IdentityAlias ¶
func (*Message) IdentityLabel ¶
func (*Message) IdentityModel ¶
func (*Message) IdentityTable ¶
func (*Message) SetWith ¶
func (z *Message) SetWith(o MessageSet)
type MessageBasic ¶
type MessageBasic struct {
// 会话编号
SessionID oid.OID `binding:"required" bson:"session_id" bun:",notnull" extensions:"x-order=A" json:"session" pg:",notnull" swaggertype:"string"`
// 角色
Role string `binding:"required" bson:"role" bun:",notnull" extensions:"x-order=B" form:"role" json:"role" pg:",notnull"`
// 内容
Content string `binding:"required" bson:"content" bun:",notnull" extensions:"x-order=C" form:"content" json:"content" pg:",notnull"`
// TokenCount
TokenCount int `` /* 133-byte string literal not displayed */
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name convoMessageBasic
func (*MessageBasic) MetaAddKVs ¶
func (in *MessageBasic) MetaAddKVs(args ...any) *MessageBasic
type MessageSet ¶
type MessageSet struct {
// 会话编号
SessionID *string `extensions:"x-order=A" json:"session"`
// 角色
Role *string `extensions:"x-order=B" json:"role"`
// 内容
Content *string `extensions:"x-order=C" json:"content"`
// TokenCount
TokenCount *int `extensions:"x-order=D" json:"tokenCount"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name convoMessageSet
func (*MessageSet) MetaAddKVs ¶
func (in *MessageSet) MetaAddKVs(args ...any) *MessageSet
type Session ¶
type Session struct {
comm.BaseModel `bun:"table:convo_session,alias:cs" json:"-"`
comm.DefaultModel
SessionBasic
comm.MetaField
comm.OwnerField
} // @name convoSession
Session 会话
func NewSessionWithBasic ¶
func NewSessionWithBasic(in SessionBasic) *Session
func NewSessionWithID ¶
func (*Session) IdentityAlias ¶
func (*Session) IdentityLabel ¶
func (*Session) IdentityModel ¶
func (*Session) IdentityTable ¶
func (*Session) SetWith ¶
func (z *Session) SetWith(o SessionSet)
type SessionBasic ¶
type SessionBasic struct {
// 标题
Title string `bson:"title" bun:",notnull" extensions:"x-order=A" form:"title" json:"title" pg:",notnull"`
// 消息数
MessageCount int `` /* 145-byte string literal not displayed */
// 状态
// * `open` - 开启
// * `closed` - 关闭
Status SessionStatus `` /* 162-byte string literal not displayed */
// 工具
Tools []string `bson:"tools" bun:",notnull,default:'[]'" extensions:"x-order=D" json:"tools" pg:",notnull,default:'[]'"`
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name convoSessionBasic
func (*SessionBasic) MetaAddKVs ¶
func (in *SessionBasic) MetaAddKVs(args ...any) *SessionBasic
type SessionSet ¶
type SessionSet struct {
// 标题
Title *string `extensions:"x-order=A" json:"title"`
// 消息数
MessageCount *int `extensions:"x-order=B" json:"msgCount"`
// 状态
// * `open` - 开启
// * `closed` - 关闭
Status *SessionStatus `enums:"open,closed" extensions:"x-order=C" json:"status" swaggertype:"string"`
// 工具
Tools *[]string `extensions:"x-order=D" json:"tools"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
// 仅用于更新所有者(负责人)
OwnerID *string `extensions:"x-order=E" json:"ownerID,omitempty"`
} // @name convoSessionSet
func (*SessionSet) MetaAddKVs ¶
func (in *SessionSet) MetaAddKVs(args ...any) *SessionSet
type SessionStatus ¶
type SessionStatus int8
状态
const ( SessionStatusOpen SessionStatus = 1 + iota // 1 开启 SessionStatusClosed // 2 关闭 )
func (*SessionStatus) Decode ¶
func (z *SessionStatus) Decode(s string) error
func (SessionStatus) MarshalText ¶
func (z SessionStatus) MarshalText() ([]byte, error)
func (SessionStatus) String ¶
func (z SessionStatus) String() string
func (*SessionStatus) UnmarshalText ¶
func (z *SessionStatus) UnmarshalText(b []byte) error
type User ¶
type User struct {
comm.BaseModel `bun:"table:convo_user,alias:au" json:"-"`
comm.DefaultModel
UserBasic
comm.MetaField
} // @name convoUser
User 用户 来自 OAuth SP 的拷贝
func NewUserWithBasic ¶
func NewUserWithID ¶
func (*User) IdentityAlias ¶
func (*User) IdentityLabel ¶
func (*User) IdentityModel ¶
func (*User) IdentityTable ¶
type UserBasic ¶
type UserBasic struct {
// 登录名 唯一
Username string `` /* 133-byte string literal not displayed */
// 昵称
Nickname string `` /* 133-byte string literal not displayed */
// 头像路径
AvatarPath string `` /* 137-byte string literal not displayed */
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name convoUserBasic
func (*UserBasic) MetaAddKVs ¶
type UserSet ¶
type UserSet struct {
// 登录名 唯一
Username *string `extensions:"x-order=A" json:"username"`
// 昵称
Nickname *string `extensions:"x-order=B" json:"nickname"`
// 头像路径
AvatarPath *string `extensions:"x-order=C" form:"avatar" json:"avatar,omitempty"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name convoUserSet
func (*UserSet) MetaAddKVs ¶
Click to show internal directories.
Click to hide internal directories.