fix(env): update STREAMING_TIMEOUT default value to 300 seconds
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
# 所有请求超时时间,单位秒,默认为0,表示不限制
|
# 所有请求超时时间,单位秒,默认为0,表示不限制
|
||||||
# RELAY_TIMEOUT=0
|
# RELAY_TIMEOUT=0
|
||||||
# 流模式无响应超时时间,单位秒,如果出现空补全可以尝试改为更大值
|
# 流模式无响应超时时间,单位秒,如果出现空补全可以尝试改为更大值
|
||||||
# STREAMING_TIMEOUT=120
|
# STREAMING_TIMEOUT=300
|
||||||
|
|
||||||
# Gemini 识别图片 最大图片数量
|
# Gemini 识别图片 最大图片数量
|
||||||
# GEMINI_VISION_MAX_IMAGE_NUM=16
|
# GEMINI_VISION_MAX_IMAGE_NUM=16
|
||||||
|
|||||||
@@ -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 120 seconds
|
- `STREAMING_TIMEOUT`: Streaming response timeout, default is 300 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`
|
||||||
|
|||||||
@@ -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`:流式回复超时时间,默认120秒
|
- `STREAMING_TIMEOUT`:流式回复超时时间,默认300秒
|
||||||
- `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`
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func InitEnv() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initConstantEnv() {
|
func initConstantEnv() {
|
||||||
constant.StreamingTimeout = GetEnvOrDefault("STREAMING_TIMEOUT", 120)
|
constant.StreamingTimeout = GetEnvOrDefault("STREAMING_TIMEOUT", 300)
|
||||||
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信息
|
||||||
|
|||||||
@@ -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=120 # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值
|
# - STREAMING_TIMEOUT=300 # 流模式无响应超时时间,单位秒,默认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
|
||||||
|
|||||||
@@ -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) // 增加缓冲区避免阻塞
|
||||||
|
|||||||
Reference in New Issue
Block a user