Files
mayfly-go/server/internal/ai/session/options.go
2026-04-15 12:47:10 +08:00

25 lines
601 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package session
// GetOptions 获取或创建会话的配置选项
type GetOptions struct {
messageLimit int // 消息条数限制0 表示加载全部
}
// GetOptions 选项函数类型
type GetOption func(*GetOptions)
// WithGetMessageLimit 设置加载的历史消息条数
// limit: 消息条数0 表示加载全部历史消息
func WithGetMessageLimit(limit int) GetOption {
return func(o *GetOptions) {
o.messageLimit = limit
}
}
// defaultGetOptions 返回默认配置
func defaultGetOptions() *GetOptions {
return &GetOptions{
messageLimit: 100000, // 默认加载全部
}
}