Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8a34d616
authored
Feb 19, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update env name and README
parent
67f02e0a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
3 deletions
+8
-3
README.en.md
+2
-0
README.md
+3
-0
constant/env.go
+1
-1
service/notify-limit.go
+2
-2
No files found.
README.en.md
View file @
8a34d616
...
@@ -89,6 +89,8 @@ You can add custom models gpt-4-gizmo-* in channels. These are third-party model
...
@@ -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`
-
`MAX_FILE_DOWNLOAD_MB`
: Maximum file download size in MB, default
`20`
-
`CRYPTO_SECRET`
: Encryption key for encrypting database content
-
`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`
-
`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
## Deployment
...
...
README.md
View file @
8a34d616
...
@@ -95,6 +95,9 @@
...
@@ -95,6 +95,9 @@
-
`MAX_FILE_DOWNLOAD_MB`
: 最大文件下载大小,单位 MB,默认为
`20`
。
-
`MAX_FILE_DOWNLOAD_MB`
: 最大文件下载大小,单位 MB,默认为
`20`
。
-
`CRYPTO_SECRET`
:加密密钥,用于加密数据库内容。
-
`CRYPTO_SECRET`
:加密密钥,用于加密数据库内容。
-
`AZURE_DEFAULT_API_VERSION`
:Azure渠道默认API版本,如果渠道设置中未指定API版本,则使用此版本,默认为
`2024-12-01-preview`
-
`AZURE_DEFAULT_API_VERSION`
:Azure渠道默认API版本,如果渠道设置中未指定API版本,则使用此版本,默认为
`2024-12-01-preview`
-
`NOTIFICATION_LIMIT_DURATION_MINUTE`
:通知限制的持续时间(分钟),默认为
`10`
。
-
`NOTIFY_LIMIT_COUNT`
:用户通知在指定持续时间内的最大数量,默认为
`2`
。
## 部署
## 部署
> [!TIP]
> [!TIP]
...
...
constant/env.go
View file @
8a34d616
...
@@ -29,7 +29,7 @@ var GeminiModelMap = map[string]string{
...
@@ -29,7 +29,7 @@ var GeminiModelMap = map[string]string{
var
GeminiVisionMaxImageNum
=
common
.
GetEnvOrDefault
(
"GEMINI_VISION_MAX_IMAGE_NUM"
,
16
)
var
GeminiVisionMaxImageNum
=
common
.
GetEnvOrDefault
(
"GEMINI_VISION_MAX_IMAGE_NUM"
,
16
)
var
DefaultNotifyHourlyLimit
=
common
.
GetEnvOrDefault
(
"NOTIFY_HOURLY_LIMI
T"
,
2
)
var
NotifyLimitCount
=
common
.
GetEnvOrDefault
(
"NOTIFY_LIMIT_COUN
T"
,
2
)
var
NotificationLimitDurationMinute
=
common
.
GetEnvOrDefault
(
"NOTIFICATION_LIMIT_DURATION_MINUTE"
,
10
)
var
NotificationLimitDurationMinute
=
common
.
GetEnvOrDefault
(
"NOTIFICATION_LIMIT_DURATION_MINUTE"
,
10
)
func
InitEnv
()
{
func
InitEnv
()
{
...
...
service/notify-limit.go
View file @
8a34d616
...
@@ -68,7 +68,7 @@ func checkRedisLimit(userId int, notifyType string) (bool, error) {
...
@@ -68,7 +68,7 @@ func checkRedisLimit(userId int, notifyType string) (bool, error) {
}
}
currentCount
,
_
:=
strconv
.
Atoi
(
count
)
currentCount
,
_
:=
strconv
.
Atoi
(
count
)
limit
:=
constant
.
DefaultNotifyHourlyLimi
t
limit
:=
constant
.
NotifyLimitCoun
t
// Check if limit is already reached
// Check if limit is already reached
if
currentCount
>=
limit
{
if
currentCount
>=
limit
{
...
@@ -107,7 +107,7 @@ func checkMemoryLimit(userId int, notifyType string) (bool, error) {
...
@@ -107,7 +107,7 @@ func checkMemoryLimit(userId int, notifyType string) (bool, error) {
currentLimit
.
Count
++
currentLimit
.
Count
++
// Check against limits
// Check against limits
limit
:=
constant
.
DefaultNotifyHourlyLimi
t
limit
:=
constant
.
NotifyLimitCoun
t
// Store updated count
// Store updated count
notifyLimitStore
.
Store
(
key
,
currentLimit
)
notifyLimitStore
.
Store
(
key
,
currentLimit
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment