- Removed Gorse-related configurations, handlers, and dependencies from the codebase. - Introduced HotRank feature with configuration options for ranking posts based on recent activity. - Updated application structure to support HotRank processing, including new caching mechanisms and database interactions. - Cleaned up related DTOs and repository methods to reflect the removal of Gorse and the addition of HotRank functionality.
27 lines
1.3 KiB
Go
27 lines
1.3 KiB
Go
package config
|
||
|
||
// HotRankConfig 热门榜定时重算(仅 Redis ZSET + 分层缓存中的 Top ID 列表,不写库)
|
||
type HotRankConfig struct {
|
||
Enabled bool `mapstructure:"enabled"`
|
||
RefreshIntervalSeconds int `mapstructure:"refresh_interval_seconds"`
|
||
// TopN 写入缓存的热门条数(ZSET 与 top_ids 列表长度上限)
|
||
TopN int `mapstructure:"top_n"`
|
||
// RecentWindowHours 候选池:该时间窗内新发的帖子 ID 会参与本轮重算
|
||
RecentWindowHours int `mapstructure:"recent_window_hours"`
|
||
// RecentFetchLimit 时间窗内最多拉取的帖子 ID 数(按 created_at 倒序)
|
||
RecentFetchLimit int `mapstructure:"recent_fetch_limit"`
|
||
// CandidateCap 候选 ID 合并后的上限(上届 Top + 新帖去重后截断)
|
||
CandidateCap int `mapstructure:"candidate_cap"`
|
||
}
|
||
|
||
// OpenAIConfig OpenAI 配置
|
||
type OpenAIConfig struct {
|
||
Enabled bool `mapstructure:"enabled"`
|
||
BaseURL string `mapstructure:"base_url"`
|
||
APIKey string `mapstructure:"api_key"`
|
||
ModerationModel string `mapstructure:"moderation_model"`
|
||
ModerationMaxImagesPerRequest int `mapstructure:"moderation_max_images_per_request"`
|
||
RequestTimeout int `mapstructure:"request_timeout"`
|
||
StrictModeration bool `mapstructure:"strict_moderation"`
|
||
}
|