Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
c2a6ca8d
Commit
c2a6ca8d
authored
Jan 09, 2026
by
song
Browse files
chore: 提升 SSE 单行上限到 40MB
parent
7b1cf2c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/internal/config/config.go
View file @
c2a6ca8d
...
@@ -544,7 +544,7 @@ func setDefaults() {
...
@@ -544,7 +544,7 @@ func setDefaults() {
viper
.
SetDefault
(
"gateway.concurrency_slot_ttl_minutes"
,
30
)
// 并发槽位过期时间(支持超长请求)
viper
.
SetDefault
(
"gateway.concurrency_slot_ttl_minutes"
,
30
)
// 并发槽位过期时间(支持超长请求)
viper
.
SetDefault
(
"gateway.stream_data_interval_timeout"
,
180
)
viper
.
SetDefault
(
"gateway.stream_data_interval_timeout"
,
180
)
viper
.
SetDefault
(
"gateway.stream_keepalive_interval"
,
10
)
viper
.
SetDefault
(
"gateway.stream_keepalive_interval"
,
10
)
viper
.
SetDefault
(
"gateway.max_line_size"
,
25
*
1024
*
1024
)
viper
.
SetDefault
(
"gateway.max_line_size"
,
40
*
1024
*
1024
)
viper
.
SetDefault
(
"gateway.scheduling.sticky_session_max_waiting"
,
3
)
viper
.
SetDefault
(
"gateway.scheduling.sticky_session_max_waiting"
,
3
)
viper
.
SetDefault
(
"gateway.scheduling.sticky_session_wait_timeout"
,
45
*
time
.
Second
)
viper
.
SetDefault
(
"gateway.scheduling.sticky_session_wait_timeout"
,
45
*
time
.
Second
)
viper
.
SetDefault
(
"gateway.scheduling.fallback_wait_timeout"
,
30
*
time
.
Second
)
viper
.
SetDefault
(
"gateway.scheduling.fallback_wait_timeout"
,
30
*
time
.
Second
)
...
...
backend/internal/service/gateway_service.go
View file @
c2a6ca8d
...
@@ -33,7 +33,7 @@ const (
...
@@ -33,7 +33,7 @@ const (
claudeAPIURL
=
"https://api.anthropic.com/v1/messages?beta=true"
claudeAPIURL
=
"https://api.anthropic.com/v1/messages?beta=true"
claudeAPICountTokensURL
=
"https://api.anthropic.com/v1/messages/count_tokens?beta=true"
claudeAPICountTokensURL
=
"https://api.anthropic.com/v1/messages/count_tokens?beta=true"
stickySessionTTL
=
time
.
Hour
// 粘性会话TTL
stickySessionTTL
=
time
.
Hour
// 粘性会话TTL
defaultMaxLineSize
=
25
*
1024
*
1024
defaultMaxLineSize
=
40
*
1024
*
1024
claudeCodeSystemPrompt
=
"You are Claude Code, Anthropic's official CLI for Claude."
claudeCodeSystemPrompt
=
"You are Claude Code, Anthropic's official CLI for Claude."
maxCacheControlBlocks
=
4
// Anthropic API 允许的最大 cache_control 块数量
maxCacheControlBlocks
=
4
// Anthropic API 允许的最大 cache_control 块数量
)
)
...
...
config.yaml
View file @
c2a6ca8d
...
@@ -154,9 +154,9 @@ gateway:
...
@@ -154,9 +154,9 @@ gateway:
# Stream keepalive interval (seconds), 0=disable
# Stream keepalive interval (seconds), 0=disable
# 流式 keepalive 间隔(秒),0=禁用
# 流式 keepalive 间隔(秒),0=禁用
stream_keepalive_interval
:
10
stream_keepalive_interval
:
10
# SSE max line size in bytes (default:
25
MB)
# SSE max line size in bytes (default:
40
MB)
# SSE 单行最大字节数(默认
25
MB)
# SSE 单行最大字节数(默认
40
MB)
max_line_size
:
2621440
0
max_line_size
:
4194304
0
# Log upstream error response body summary (safe/truncated; does not log request content)
# Log upstream error response body summary (safe/truncated; does not log request content)
# 记录上游错误响应体摘要(安全/截断;不记录请求内容)
# 记录上游错误响应体摘要(安全/截断;不记录请求内容)
log_upstream_error_body
:
false
log_upstream_error_body
:
false
...
...
deploy/config.example.yaml
View file @
c2a6ca8d
...
@@ -154,9 +154,9 @@ gateway:
...
@@ -154,9 +154,9 @@ gateway:
# Stream keepalive interval (seconds), 0=disable
# Stream keepalive interval (seconds), 0=disable
# 流式 keepalive 间隔(秒),0=禁用
# 流式 keepalive 间隔(秒),0=禁用
stream_keepalive_interval
:
10
stream_keepalive_interval
:
10
# SSE max line size in bytes (default:
25
MB)
# SSE max line size in bytes (default:
40
MB)
# SSE 单行最大字节数(默认
25
MB)
# SSE 单行最大字节数(默认
40
MB)
max_line_size
:
2621440
0
max_line_size
:
4194304
0
# Log upstream error response body summary (safe/truncated; does not log request content)
# Log upstream error response body summary (safe/truncated; does not log request content)
# 记录上游错误响应体摘要(安全/截断;不记录请求内容)
# 记录上游错误响应体摘要(安全/截断;不记录请求内容)
log_upstream_error_body
:
false
log_upstream_error_body
:
false
...
...
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