aigc

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: 3 Imported by: 0

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

func (HiAscend) Len

func (a HiAscend) Len() int

Len returns the number of history records

func (HiAscend) Less

func (a HiAscend) Less(i, j int) bool

Less compares the time of two history records for ascending order

func (HiAscend) Swap

func (a HiAscend) Swap(i, j int)

Swap swaps the positions of two history records

type HiLogged

type HiLogged HistoryItems

HiLogged 是 HistoryItems 的自定义类型,用于日志输出

func (HiLogged) String

func (z HiLogged) String() string

String 返回每个记录的前30个字的文本,用于日志记录

type HistoryChatItem

type HistoryChatItem struct {
	User      string `json:"u"`
	Assistant string `json:"a"`
}

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) ToText

func (z HistoryItems) ToText() string

ToText 将历史记录转换为纯文本格式

func (*HistoryItems) UnmarshalBinary

func (z *HistoryItems) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshal a binary representation of itself. for redis result.Scan

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

Jump to

Keyboard shortcuts

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