Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelConfig ¶ added in v0.3.0
type ChannelConfig struct {
Enable bool `json:"enable,omitempty" yaml:"enable,omitempty"`
Mode string `json:"mode,omitempty" yaml:"mode,omitempty"` // "websocket", "webhook"
Config map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}
ChannelConfig holds configuration for a single channel adapter.
type HiAscend ¶
type HiAscend HistoryItems
HiAscend is history records sorted by time in ascending order, for sort.Interface
type HistoryChatItem ¶
type HistoryChatItem struct {
User string `json:"u"`
Assistant string `json:"a"`
Think string `json:"th,omitempty"` // reasoning/thinking content
}
HistoryChatItem is a single message in chat history
type HistoryItem ¶
type HistoryItem struct {
Time int64 `json:"ts"`
UID string `json:"uid,omitempty"`
// chat
ChatItem *HistoryChatItem `json:"ci"`
}
HistoryItem is a history record item with timestamp and chat content
func (*HistoryItem) MarshalBinary ¶
func (z *HistoryItem) MarshalBinary() (data []byte, err error)
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*HistoryItem) UnmarshalBinary ¶
func (z *HistoryItem) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshal a binary representation of itself. for redis result.Scan
type HistoryItems ¶
type HistoryItems []HistoryItem
HistoryItems is a list of history records
func (HistoryItems) MarshalBinary ¶
func (z HistoryItems) MarshalBinary() (data []byte, err error)
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (HistoryItems) RecentlyWithTokens ¶
func (z HistoryItems) RecentlyWithTokens(size int) (ohi HistoryItems)
RecentlyWithTokens returns the most recent history records with total tokens not exceeding size
func (*HistoryItems) UnmarshalBinary ¶
func (z *HistoryItems) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshal a binary representation of itself. for redis result.Scan
type MatchResult ¶ added in v0.4.0
type MatchResult struct {
// DocID 关联文档的 ID
DocID oid.OID `bson:"docID" extensions:"x-order=A" json:"docID" swaggertype:"string"`
// 主题
Subject string `bson:"subject" extensions:"x-order=B" form:"subject" json:"subject"`
// 相似度
Similarity float32 `bson:"similarity" extensions:"x-order=C" json:"similarity"`
}
MatchResult 通用匹配结果结构 用于向量检索返回的匹配结果
type MatchResults ¶ added in v0.4.0
type MatchResults []MatchResult
MatchResults is a slice of MatchResult
func (MatchResults) DocIDs ¶ added in v0.4.0
func (z MatchResults) DocIDs() (out oid.OIDs)
DocIDs returns the document IDs from all match results
type Preset ¶
type Preset struct {
Welcome string `json:"welcome,omitempty" yaml:"welcome,omitempty"`
SystemPrompt string `json:"systemPrompt,omitempty" yaml:"systemPrompt,omitempty"`
ToolsPrompt string `json:"toolsPrompt,omitempty" yaml:"toolsPrompt,omitempty"`
ChannelPrompt string `json:"channelPrompt,omitempty" yaml:"channelPrompt,omitempty"`
KeywordTpl string `json:"keywordTpl,omitempty" yaml:"keywordTpl,omitempty"`
TitleTpl string `json:"titleTpl,omitempty" yaml:"titleTpl,omitempty"`
// toolName -> description
Tools map[string]string `json:"tools,omitempty" yaml:"tools,omitempty"`
// Channels holds channel adapter configurations
Channels map[string]ChannelConfig `json:"channels,omitempty" yaml:"channels,omitempty"`
}
Preset is the preset configuration including welcome message, system prompt and tool descriptions