convo

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 3 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 (
	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 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:'[]'"`
	// 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 Sessions

type Sessions []Session

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 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) 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 */
	// 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"`
	// 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