convo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 5 Imported by: 0

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 (
	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) Keys added in v0.2.4

func (z Memories) Keys() []string

func (Memories) PrettyTextForOwner added in v0.2.4

func (z Memories) PrettyTextForOwner() string

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 NewMemoryWithID(id any) *Memory

func (*Memory) Creating added in v0.2.3

func (z *Memory) Creating() error

Creating function call to it's inner fields defined hooks

func (*Memory) IdentityAlias added in v0.2.3

func (_ *Memory) IdentityAlias() string

func (*Memory) IdentityLabel added in v0.2.3

func (_ *Memory) IdentityLabel() string

func (*Memory) IdentityModel added in v0.2.3

func (_ *Memory) IdentityModel() string

func (*Memory) IdentityTable added in v0.2.3

func (_ *Memory) IdentityTable() string

func (*Memory) SetWith added in v0.2.3

func (z *Memory) SetWith(o MemorySet)

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

func (in *MemorySet) MetaAddKVs(args ...any) *MemorySet

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 NewMessageWithID(id any) *Message

func (*Message) Creating

func (z *Message) Creating() error

Creating function call to it's inner fields defined hooks

func (*Message) IdentityAlias

func (_ *Message) IdentityAlias() string

func (*Message) IdentityLabel

func (_ *Message) IdentityLabel() string

func (*Message) IdentityModel

func (_ *Message) IdentityModel() string

func (*Message) IdentityTable

func (_ *Message) IdentityTable() string

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 Messages

type Messages []Message

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 NewSessionWithID(id any) *Session

func (*Session) Creating

func (z *Session) Creating() error

Creating function call to it's inner fields defined hooks

func (*Session) IdentityAlias

func (_ *Session) IdentityAlias() string

func (*Session) IdentityLabel

func (_ *Session) IdentityLabel() string

func (*Session) IdentityModel

func (_ *Session) IdentityModel() string

func (*Session) IdentityTable

func (_ *Session) IdentityTable() string

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 Sessions

type Sessions []Session

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 NewThirdUserWithID(id any) *ThirdUser

func (*ThirdUser) Creating added in v0.3.0

func (z *ThirdUser) Creating() error

Creating function call to it's inner fields defined hooks

func (*ThirdUser) IdentityAlias added in v0.3.0

func (_ *ThirdUser) IdentityAlias() string

func (*ThirdUser) IdentityLabel added in v0.3.0

func (_ *ThirdUser) IdentityLabel() string

func (*ThirdUser) IdentityModel added in v0.3.0

func (_ *ThirdUser) IdentityModel() string

func (*ThirdUser) IdentityTable added in v0.3.0

func (_ *ThirdUser) IdentityTable() string

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 NewUserWithBasic(in UserBasic) *User

func NewUserWithID

func NewUserWithID(id any) *User

func (*User) Creating

func (z *User) Creating() error

Creating function call to it's inner fields defined hooks

func (*User) GetAvatar added in v0.3.0

func (u *User) GetAvatar() string

func (*User) GetName added in v0.3.0

func (u *User) GetName() string

func (*User) GetOID added in v0.3.0

func (u *User) GetOID() string

func (*User) GetUID added in v0.3.0

func (u *User) GetUID() string

func (*User) IdentityAlias

func (_ *User) IdentityAlias() string

func (*User) IdentityLabel

func (_ *User) IdentityLabel() string

func (*User) IdentityModel

func (_ *User) IdentityModel() string

func (*User) IdentityTable

func (_ *User) IdentityTable() string

func (*User) SetWith

func (z *User) SetWith(o UserSet)

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

func (in *UserBasic) MetaAddKVs(args ...any) *UserBasic

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

func (in *UserSet) MetaAddKVs(args ...any) *UserSet

type Users

type Users []User

Jump to

Keyboard shortcuts

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