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
c7281a35
authored
Aug 12, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(env): update STREAMING_TIMEOUT default value to 300 seconds
parent
1382ec4f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
9 deletions
+5
-9
.env.example
+1
-1
README.en.md
+1
-1
README.md
+1
-1
common/init.go
+1
-1
docker-compose.yml
+1
-1
relay/helper/stream_scanner.go
+0
-4
No files found.
.env.example
View file @
c7281a35
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
# 所有请求超时时间,单位秒,默认为0,表示不限制
# 所有请求超时时间,单位秒,默认为0,表示不限制
# RELAY_TIMEOUT=0
# RELAY_TIMEOUT=0
# 流模式无响应超时时间,单位秒,如果出现空补全可以尝试改为更大值
# 流模式无响应超时时间,单位秒,如果出现空补全可以尝试改为更大值
# STREAMING_TIMEOUT=
12
0
# STREAMING_TIMEOUT=
30
0
# Gemini 识别图片 最大图片数量
# Gemini 识别图片 最大图片数量
# GEMINI_VISION_MAX_IMAGE_NUM=16
# GEMINI_VISION_MAX_IMAGE_NUM=16
...
...
README.en.md
View file @
c7281a35
...
@@ -100,7 +100,7 @@ This version supports multiple models, please refer to [API Documentation-Relay
...
@@ -100,7 +100,7 @@ This version supports multiple models, please refer to [API Documentation-Relay
For detailed configuration instructions, please refer to
[
Installation Guide-Environment Variables Configuration
](
https://docs.newapi.pro/installation/environment-variables
)
:
For detailed configuration instructions, please refer to
[
Installation Guide-Environment Variables Configuration
](
https://docs.newapi.pro/installation/environment-variables
)
:
-
`GENERATE_DEFAULT_TOKEN`
: Whether to generate initial tokens for newly registered users, default is
`false`
-
`GENERATE_DEFAULT_TOKEN`
: Whether to generate initial tokens for newly registered users, default is
`false`
-
`STREAMING_TIMEOUT`
: Streaming response timeout, default is
12
0 seconds
-
`STREAMING_TIMEOUT`
: Streaming response timeout, default is
30
0 seconds
-
`DIFY_DEBUG`
: Whether to output workflow and node information for Dify channels, default is
`true`
-
`DIFY_DEBUG`
: Whether to output workflow and node information for Dify channels, default is
`true`
-
`FORCE_STREAM_OPTION`
: Whether to override client stream_options parameter, default is
`true`
-
`FORCE_STREAM_OPTION`
: Whether to override client stream_options parameter, default is
`true`
-
`GET_MEDIA_TOKEN`
: Whether to count image tokens, default is
`true`
-
`GET_MEDIA_TOKEN`
: Whether to count image tokens, default is
`true`
...
...
README.md
View file @
c7281a35
...
@@ -100,7 +100,7 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do
...
@@ -100,7 +100,7 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do
详细配置说明请参考
[
安装指南-环境变量配置
](
https://docs.newapi.pro/installation/environment-variables
)
:
详细配置说明请参考
[
安装指南-环境变量配置
](
https://docs.newapi.pro/installation/environment-variables
)
:
-
`GENERATE_DEFAULT_TOKEN`
:是否为新注册用户生成初始令牌,默认为
`false`
-
`GENERATE_DEFAULT_TOKEN`
:是否为新注册用户生成初始令牌,默认为
`false`
-
`STREAMING_TIMEOUT`
:流式回复超时时间,默认
12
0秒
-
`STREAMING_TIMEOUT`
:流式回复超时时间,默认
30
0秒
-
`DIFY_DEBUG`
:Dify渠道是否输出工作流和节点信息,默认
`true`
-
`DIFY_DEBUG`
:Dify渠道是否输出工作流和节点信息,默认
`true`
-
`FORCE_STREAM_OPTION`
:是否覆盖客户端stream_options参数,默认
`true`
-
`FORCE_STREAM_OPTION`
:是否覆盖客户端stream_options参数,默认
`true`
-
`GET_MEDIA_TOKEN`
:是否统计图片token,默认
`true`
-
`GET_MEDIA_TOKEN`
:是否统计图片token,默认
`true`
...
...
common/init.go
View file @
c7281a35
...
@@ -101,7 +101,7 @@ func InitEnv() {
...
@@ -101,7 +101,7 @@ func InitEnv() {
}
}
func
initConstantEnv
()
{
func
initConstantEnv
()
{
constant
.
StreamingTimeout
=
GetEnvOrDefault
(
"STREAMING_TIMEOUT"
,
12
0
)
constant
.
StreamingTimeout
=
GetEnvOrDefault
(
"STREAMING_TIMEOUT"
,
30
0
)
constant
.
DifyDebug
=
GetEnvOrDefaultBool
(
"DIFY_DEBUG"
,
true
)
constant
.
DifyDebug
=
GetEnvOrDefaultBool
(
"DIFY_DEBUG"
,
true
)
constant
.
MaxFileDownloadMB
=
GetEnvOrDefault
(
"MAX_FILE_DOWNLOAD_MB"
,
20
)
constant
.
MaxFileDownloadMB
=
GetEnvOrDefault
(
"MAX_FILE_DOWNLOAD_MB"
,
20
)
// ForceStreamOption 覆盖请求参数,强制返回usage信息
// ForceStreamOption 覆盖请求参数,强制返回usage信息
...
...
docker-compose.yml
View file @
c7281a35
...
@@ -16,7 +16,7 @@ services:
...
@@ -16,7 +16,7 @@ services:
-
REDIS_CONN_STRING=redis://redis
-
REDIS_CONN_STRING=redis://redis
-
TZ=Asia/Shanghai
-
TZ=Asia/Shanghai
-
ERROR_LOG_ENABLED=true
# 是否启用错误日志记录
-
ERROR_LOG_ENABLED=true
# 是否启用错误日志记录
# - STREAMING_TIMEOUT=
12
0 # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值
# - STREAMING_TIMEOUT=
30
0 # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值
# - SESSION_SECRET=random_string # 多机部署时设置,必须修改这个随机字符串!!!!!!!
# - SESSION_SECRET=random_string # 多机部署时设置,必须修改这个随机字符串!!!!!!!
# - NODE_TYPE=slave # Uncomment for slave node in multi-node deployment
# - NODE_TYPE=slave # Uncomment for slave node in multi-node deployment
# - SYNC_FREQUENCY=60 # Uncomment if regular database syncing is needed
# - SYNC_FREQUENCY=60 # Uncomment if regular database syncing is needed
...
...
relay/helper/stream_scanner.go
View file @
c7281a35
...
@@ -39,10 +39,6 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
...
@@ -39,10 +39,6 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
}()
}()
streamingTimeout
:=
time
.
Duration
(
constant
.
StreamingTimeout
)
*
time
.
Second
streamingTimeout
:=
time
.
Duration
(
constant
.
StreamingTimeout
)
*
time
.
Second
if
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"o"
)
{
// twice timeout for thinking model
streamingTimeout
*=
2
}
var
(
var
(
stopChan
=
make
(
chan
bool
,
3
)
// 增加缓冲区避免阻塞
stopChan
=
make
(
chan
bool
,
3
)
// 增加缓冲区避免阻塞
...
...
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