Documentation
¶
Index ¶
- Constants
- type Memories
- type Memory
- type MemoryBasic
- type MemorySet
- type Message
- type MessageBasic
- type MessageSet
- type Messages
- type Session
- type SessionBasic
- type SessionSet
- type SessionStatus
- type Sessions
- type ThirdUser
- type ThirdUserBasic
- type ThirdUserSet
- type ThirdUsers
- type UsageRecord
- type UsageRecordBasic
- type UsageRecordSet
- type UsageRecords
- type User
- func (z *User) Creating() error
- func (u *User) GetAvatar() string
- func (u *User) GetName() string
- func (u *User) GetOID() string
- func (u *User) GetUID() string
- func (_ *User) IdentityAlias() string
- func (_ *User) IdentityLabel() string
- func (_ *User) IdentityModel() string
- func (_ *User) IdentityTable() string
- func (z *User) SetWith(o UserSet)
- type UserBasic
- type UserSet
- type Users
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 ( UsageRecordTable = "convo_usage_record" UsageRecordAlias = "ur" UsageRecordLabel = "usageRecord" UsageRecordTypID = "convoUsageRecord" )
consts of UsageRecord 使用情况
View Source
const ( UserTable = "convo_user" UserAlias = "u" UserLabel = "user" UserTypID = "convoUser" )
consts of User 用户
View Source
const ( ThirdUserTable = "convo_third_user" ThirdUserAlias = "tu" ThirdUserLabel = "thirdUser" ThirdUserTypID = "convoThirdUser" )
consts of ThirdUser 第三方用户
View Source
const ( MemoryTable = "convo_memory" MemoryAlias = "m" MemoryLabel = "memory" MemoryTypID = "convoMemory" )
consts of Memory 记忆
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Memories ¶ added in v0.2.3
type Memories []Memory
func (Memories) PrettyTextForOwner ¶ added in v0.2.4
PrettyText 用于格式显式某个人的记忆清单
type Memory ¶ added in v0.2.3
type Memory struct {
comm.BaseModel `bun:"table:convo_memory,alias:m" json:"-"`
comm.DefaultModel
MemoryBasic
comm.MetaField
} // @name convoMemory
Memory 记忆
func NewMemoryWithBasic ¶ added in v0.2.3
func NewMemoryWithBasic(in MemoryBasic) *Memory
func NewMemoryWithID ¶ added in v0.2.3
func (*Memory) IdentityAlias ¶ added in v0.2.3
func (*Memory) IdentityLabel ¶ added in v0.2.3
func (*Memory) IdentityModel ¶ added in v0.2.3
func (*Memory) IdentityTable ¶ added in v0.2.3
type MemoryBasic ¶ added in v0.2.3
type MemoryBasic struct {
// 所有人编号
OwnerID oid.OID `` /* 171-byte string literal not displayed */
// 关键点
Key string `` /* 137-byte string literal not displayed */
// 分类
Cate string `bun:",notnull,type:text" extensions:"x-order=C" form:"cate" json:"cate" pg:",notnull,type:text"`
// 内容
Content string `bun:",notnull,type:text" extensions:"x-order=D" form:"content" json:"content" pg:",notnull,type:text"`
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name convoMemoryBasic
func (*MemoryBasic) GetOwnerID ¶ added in v0.2.3
func (m *MemoryBasic) GetOwnerID() oid.OID
GetOwnerID 返回所有者ID
func (MemoryBasic) GetSubject ¶ added in v0.2.3
func (z MemoryBasic) GetSubject() string
GetSubject returns the document subject (key + category + content)
func (*MemoryBasic) MetaAddKVs ¶ added in v0.2.3
func (in *MemoryBasic) MetaAddKVs(args ...any) *MemoryBasic
func (*MemoryBasic) OwnerEmpty ¶ added in v0.2.3
func (m *MemoryBasic) OwnerEmpty() bool
ownerID 可否为空
func (*MemoryBasic) SetOwnerID ¶ added in v0.2.3
func (m *MemoryBasic) SetOwnerID(id any) bool
SetOwnerID 设置所有者ID
type MemorySet ¶ added in v0.2.3
type MemorySet struct {
// 分类
Cate *string `extensions:"x-order=A" json:"cate"`
// 内容
Content *string `extensions:"x-order=B" json:"content"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name convoMemorySet
func (*MemorySet) MetaAddKVs ¶ added in v0.2.3
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:'[]'"`
// 频道
Channel string `` /* 130-byte string literal not displayed */
// 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"`
// 频道
Channel *string `extensions:"x-order=E" json:"channel"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
// 仅用于更新所有者(负责人)
OwnerID *string `extensions:"x-order=F" 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 ThirdUser ¶ added in v0.3.0
type ThirdUser struct {
comm.BaseModel `bun:"table:convo_third_user,alias:tu" json:"-"`
comm.DunceModel
ThirdUserBasic
comm.MetaField
} // @name convoThirdUser
ThirdUser 第三方用户 来自不同平台 如微信和飞书等 PK为第三方平台标识+账号
func NewThirdUserWithBasic ¶ added in v0.3.0
func NewThirdUserWithBasic(in ThirdUserBasic) *ThirdUser
func NewThirdUserWithID ¶ added in v0.3.0
func (*ThirdUser) Creating ¶ added in v0.3.0
Creating function call to it's inner fields defined hooks
func (*ThirdUser) IdentityAlias ¶ added in v0.3.0
func (*ThirdUser) IdentityLabel ¶ added in v0.3.0
func (*ThirdUser) IdentityModel ¶ added in v0.3.0
func (*ThirdUser) IdentityTable ¶ added in v0.3.0
func (*ThirdUser) SetWith ¶ added in v0.3.0
func (z *ThirdUser) SetWith(o ThirdUserSet)
type ThirdUserBasic ¶ added in v0.3.0
type ThirdUserBasic struct {
// 所有人编号
OwnerID oid.OID `` /* 127-byte string literal not displayed */
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name convoThirdUserBasic
func (*ThirdUserBasic) MetaAddKVs ¶ added in v0.3.0
func (in *ThirdUserBasic) MetaAddKVs(args ...any) *ThirdUserBasic
type ThirdUserSet ¶ added in v0.3.0
type ThirdUserSet struct {
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name convoThirdUserSet
func (*ThirdUserSet) MetaAddKVs ¶ added in v0.3.0
func (in *ThirdUserSet) MetaAddKVs(args ...any) *ThirdUserSet
type ThirdUsers ¶ added in v0.3.0
type ThirdUsers []ThirdUser
type UsageRecord ¶ added in v0.2.4
type UsageRecord struct {
comm.BaseModel `bun:"table:convo_usage_record,alias:ur" json:"-"`
comm.DefaultModel
UsageRecordBasic
comm.MetaField
} // @name convoUsageRecord
UsageRecord 使用情况 每次请求后记录
func NewUsageRecordWithBasic ¶ added in v0.2.4
func NewUsageRecordWithBasic(in UsageRecordBasic) *UsageRecord
func NewUsageRecordWithID ¶ added in v0.2.4
func NewUsageRecordWithID(id any) *UsageRecord
func (*UsageRecord) Creating ¶ added in v0.2.4
func (z *UsageRecord) Creating() error
Creating function call to it's inner fields defined hooks
func (*UsageRecord) IdentityAlias ¶ added in v0.2.4
func (_ *UsageRecord) IdentityAlias() string
func (*UsageRecord) IdentityLabel ¶ added in v0.2.4
func (_ *UsageRecord) IdentityLabel() string
func (*UsageRecord) IdentityModel ¶ added in v0.2.4
func (_ *UsageRecord) IdentityModel() string
func (*UsageRecord) IdentityTable ¶ added in v0.2.4
func (_ *UsageRecord) IdentityTable() string
func (*UsageRecord) SetWith ¶ added in v0.2.4
func (z *UsageRecord) SetWith(o UsageRecordSet)
type UsageRecordBasic ¶ added in v0.2.4
type UsageRecordBasic struct {
// 会话编号
SessionID oid.OID `binding:"required" bson:"session_id" bun:",notnull" extensions:"x-order=A" json:"session" pg:",notnull" swaggertype:"string"`
// 消息数
MsgCount int `` /* 127-byte string literal not displayed */
// 输入Token数
InputTokens int `` /* 126-byte string literal not displayed */
// 输出Token数
OutputTokens int `` /* 129-byte string literal not displayed */
// 总Token数
TotalTokens int `` /* 126-byte string literal not displayed */
// 模型
Model string `bson:"model" bun:",notnull,type:name" extensions:"x-order=F" form:"model" json:"model" pg:",notnull,type:name"`
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name convoUsageRecordBasic
func (*UsageRecordBasic) MetaAddKVs ¶ added in v0.2.4
func (in *UsageRecordBasic) MetaAddKVs(args ...any) *UsageRecordBasic
type UsageRecordSet ¶ added in v0.2.4
type UsageRecordSet struct {
// 消息数
MsgCount *int `extensions:"x-order=A" json:"msgCount"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name convoUsageRecordSet
func (*UsageRecordSet) MetaAddKVs ¶ added in v0.2.4
func (in *UsageRecordSet) MetaAddKVs(args ...any) *UsageRecordSet
type UsageRecords ¶ added in v0.2.4
type UsageRecords []UsageRecord
type User ¶
type User struct {
comm.BaseModel `bun:"table:convo_user,alias:u" 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 */
// 邮箱
Email string `` /* 140-byte string literal not displayed */
// 电话
Phone string `` /* 140-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"`
// 邮箱
Email *string `extensions:"x-order=D" form:"email" json:"email,omitempty"`
// 电话
Phone *string `extensions:"x-order=E" form:"phone" json:"phone,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.