Browse Source

chore: update env name and README

[email protected] 10 months ago
parent
commit
90191b8d5b
4 changed files with 8 additions and 3 deletions
  1. 2 0
      README.en.md
  2. 3 0
      README.md
  3. 1 1
      constant/env.go
  4. 2 2
      service/notify-limit.go

+ 2 - 0
README.en.md

@@ -89,6 +89,8 @@ You can add custom models gpt-4-gizmo-* in channels. These are third-party model
 - `MAX_FILE_DOWNLOAD_MB`: Maximum file download size in MB, default `20`
 - `CRYPTO_SECRET`: Encryption key for encrypting database content
 - `AZURE_DEFAULT_API_VERSION`: Azure channel default API version, if not specified in channel settings, use this version, default `2024-12-01-preview`
+- `NOTIFICATION_LIMIT_DURATION_MINUTE`: Duration of notification limit in minutes, default `10`
+- `NOTIFY_LIMIT_COUNT`: Maximum number of user notifications in the specified duration, default `2`
 
 ## Deployment
 

+ 3 - 0
README.md

@@ -95,6 +95,9 @@
 - `MAX_FILE_DOWNLOAD_MB`: 最大文件下载大小,单位 MB,默认为 `20`。
 - `CRYPTO_SECRET`:加密密钥,用于加密数据库内容。
 - `AZURE_DEFAULT_API_VERSION`:Azure渠道默认API版本,如果渠道设置中未指定API版本,则使用此版本,默认为 `2024-12-01-preview`
+- `NOTIFICATION_LIMIT_DURATION_MINUTE`:通知限制的持续时间(分钟),默认为 `10`。
+- `NOTIFY_LIMIT_COUNT`:用户通知在指定持续时间内的最大数量,默认为 `2`。
+
 ## 部署
 
 > [!TIP]

+ 1 - 1
constant/env.go

@@ -29,7 +29,7 @@ var GeminiModelMap = map[string]string{
 
 var GeminiVisionMaxImageNum = common.GetEnvOrDefault("GEMINI_VISION_MAX_IMAGE_NUM", 16)
 
-var DefaultNotifyHourlyLimit = common.GetEnvOrDefault("NOTIFY_HOURLY_LIMIT", 2)
+var NotifyLimitCount = common.GetEnvOrDefault("NOTIFY_LIMIT_COUNT", 2)
 var NotificationLimitDurationMinute = common.GetEnvOrDefault("NOTIFICATION_LIMIT_DURATION_MINUTE", 10)
 
 func InitEnv() {

+ 2 - 2
service/notify-limit.go

@@ -68,7 +68,7 @@ func checkRedisLimit(userId int, notifyType string) (bool, error) {
 	}
 
 	currentCount, _ := strconv.Atoi(count)
-	limit := constant.DefaultNotifyHourlyLimit
+	limit := constant.NotifyLimitCount
 
 	// Check if limit is already reached
 	if currentCount >= limit {
@@ -107,7 +107,7 @@ func checkMemoryLimit(userId int, notifyType string) (bool, error) {
 	currentLimit.Count++
 
 	// Check against limits
-	limit := constant.DefaultNotifyHourlyLimit
+	limit := constant.NotifyLimitCount
 
 	// Store updated count
 	notifyLimitStore.Store(key, currentLimit)