refactor: remove Gorse integration and implement HotRank feature
- 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.
This commit is contained in:
@@ -22,13 +22,13 @@ type Config struct {
|
||||
Log LogConfig `mapstructure:"log"`
|
||||
RateLimit RateLimitConfig `mapstructure:"rate_limit"`
|
||||
Upload UploadConfig `mapstructure:"upload"`
|
||||
Gorse GorseConfig `mapstructure:"gorse"`
|
||||
OpenAI OpenAIConfig `mapstructure:"openai"`
|
||||
Email EmailConfig `mapstructure:"email"`
|
||||
ConversationCache ConversationCacheConfig `mapstructure:"conversation_cache"`
|
||||
GRPC GRPCConfig `mapstructure:"grpc"`
|
||||
Casbin CasbinConfig `mapstructure:"casbin"`
|
||||
Encryption EncryptionConfig `mapstructure:"encryption"`
|
||||
HotRank HotRankConfig `mapstructure:"hot_rank"`
|
||||
}
|
||||
|
||||
// Load 加载配置文件
|
||||
@@ -97,14 +97,6 @@ func Load(configPath string) (*Config, error) {
|
||||
viper.SetDefault("sensitive.replace_str", "***")
|
||||
viper.SetDefault("audit.enabled", false)
|
||||
viper.SetDefault("audit.provider", "local")
|
||||
viper.SetDefault("gorse.enabled", false)
|
||||
viper.SetDefault("gorse.address", "http://localhost:8087")
|
||||
viper.SetDefault("gorse.api_key", "")
|
||||
viper.SetDefault("gorse.dashboard", "http://localhost:8088")
|
||||
viper.SetDefault("gorse.import_password", "")
|
||||
viper.SetDefault("gorse.embedding_api_key", "")
|
||||
viper.SetDefault("gorse.embedding_url", "https://api.littlelan.cn/v1/embeddings")
|
||||
viper.SetDefault("gorse.embedding_model", "BAAI/bge-m3")
|
||||
viper.SetDefault("openai.enabled", true)
|
||||
viper.SetDefault("openai.base_url", "https://api.littlelan.cn/")
|
||||
viper.SetDefault("openai.api_key", "")
|
||||
@@ -152,6 +144,12 @@ func Load(configPath string) (*Config, error) {
|
||||
viper.SetDefault("encryption.enabled", false)
|
||||
viper.SetDefault("encryption.key", "")
|
||||
viper.SetDefault("encryption.key_version", 1)
|
||||
viper.SetDefault("hot_rank.enabled", true)
|
||||
viper.SetDefault("hot_rank.refresh_interval_seconds", 300)
|
||||
viper.SetDefault("hot_rank.top_n", 100)
|
||||
viper.SetDefault("hot_rank.recent_window_hours", 168)
|
||||
viper.SetDefault("hot_rank.recent_fetch_limit", 500)
|
||||
viper.SetDefault("hot_rank.candidate_cap", 800)
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
return nil, fmt.Errorf("failed to read config: %w", err)
|
||||
@@ -203,13 +201,6 @@ func Load(configPath string) (*Config, error) {
|
||||
cfg.Server.Host = getEnvOrDefault("APP_SERVER_HOST", cfg.Server.Host)
|
||||
cfg.Server.Port, _ = strconv.Atoi(getEnvOrDefault("APP_SERVER_PORT", fmt.Sprintf("%d", cfg.Server.Port)))
|
||||
cfg.Server.Mode = getEnvOrDefault("APP_SERVER_MODE", cfg.Server.Mode)
|
||||
cfg.Gorse.Address = getEnvOrDefault("APP_GORSE_ADDRESS", cfg.Gorse.Address)
|
||||
cfg.Gorse.APIKey = getEnvOrDefault("APP_GORSE_API_KEY", cfg.Gorse.APIKey)
|
||||
cfg.Gorse.Dashboard = getEnvOrDefault("APP_GORSE_DASHBOARD", cfg.Gorse.Dashboard)
|
||||
cfg.Gorse.ImportPassword = getEnvOrDefault("APP_GORSE_IMPORT_PASSWORD", cfg.Gorse.ImportPassword)
|
||||
cfg.Gorse.EmbeddingAPIKey = getEnvOrDefault("APP_GORSE_EMBEDDING_API_KEY", cfg.Gorse.EmbeddingAPIKey)
|
||||
cfg.Gorse.EmbeddingURL = getEnvOrDefault("APP_GORSE_EMBEDDING_URL", cfg.Gorse.EmbeddingURL)
|
||||
cfg.Gorse.EmbeddingModel = getEnvOrDefault("APP_GORSE_EMBEDDING_MODEL", cfg.Gorse.EmbeddingModel)
|
||||
cfg.OpenAI.BaseURL = getEnvOrDefault("APP_OPENAI_BASE_URL", cfg.OpenAI.BaseURL)
|
||||
cfg.OpenAI.APIKey = getEnvOrDefault("APP_OPENAI_API_KEY", cfg.OpenAI.APIKey)
|
||||
cfg.OpenAI.ModerationModel = getEnvOrDefault("APP_OPENAI_MODERATION_MODEL", cfg.OpenAI.ModerationModel)
|
||||
|
||||
Reference in New Issue
Block a user