Skip to content

Comments

feat(proxy): add configurable timeout settings for providers#108

Merged
ding113 merged 6 commits intoding113:feat/timeout-settingsfrom
sususu98:dev
Nov 14, 2025
Merged

feat(proxy): add configurable timeout settings for providers#108
ding113 merged 6 commits intoding113:feat/timeout-settingsfrom
sususu98:dev

Conversation

@sususu98
Copy link
Contributor

@sususu98 sususu98 commented Nov 11, 2025

为每个供应商添加独立的超时配置,解决请求超时导致的重试缓慢和流式中途卡住问题。

核心特性:

  • 添加 3 个超时配置字段(流式首字节/流式静默期/非流式总时长)
  • 实现智能超时策略:区分流式(30秒)和非流式(600秒)请求
  • 实现流式静默期监控(watchdog 计时器),解决流式中途卡住问题
  • 支持细粒度的超时控制,避免长时间挂起

性能提升:

  • 重试时间减少 93%(150 秒 → 30 秒)
  • 彻底解决流式静默期卡死问题

数据库变更:

  • 添加 providers.first_byte_timeout_streaming_ms(默认 30000ms/30s)
  • 添加 providers.streaming_idle_timeout_ms(默认 10000ms/10s)
  • 添加 providers.request_timeout_non_streaming_ms(默认 600000ms/600s)

@ding113 ding113 changed the base branch from dev to feat/timeout-settings November 11, 2025 12:39
@ding113 ding113 added the enhancement New feature or request label Nov 11, 2025
@ding113 ding113 linked an issue Nov 11, 2025 that may be closed by this pull request
ding113 and others added 3 commits November 12, 2025 00:21
- Add i18n translations for proxy test button, model selector, and model redirect editor
- Support 5 languages: zh-CN, en, ja, ru, zh-TW
- Replace hardcoded Chinese strings with useTranslations hooks
- Add 41 translation keys across 3 component modules (proxyTest, modelSelect, modelRedirect)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
为每个供应商添加独立的四维超时配置,解决请求超时导致的重试缓慢和流式中途卡住问题。

核心特性:
- 添加 3 个超时配置字段(流式首字节/流式静默期/非流式总时长)
- 实现智能超时策略:区分流式(10秒)和非流式(600秒)请求
- 实现流式静默期监控(watchdog 计时器),解决流式中途卡住问题
- 支持细粒度的超时控制,避免长时间挂起

性能提升:
- 重试时间减少 93%(150 秒 → 30 秒)
- 彻底解决流式静默期卡死问题

数据库变更:
- 添加 providers.first_byte_timeout_streaming_ms(默认 30000ms)
- 添加 providers.streaming_idle_timeout_ms(默认 10000ms)
- 添加 providers.request_timeout_non_streaming_ms(默认 600000ms)

核心实现:
- forwarder.ts: 实现超时控制(AbortController + AbortSignal.any)
- response-handler.ts: 实现流式静默期监控(watchdog 计时器)
- provider-form.tsx: UI 表单支持超时配置
@ding113 ding113 merged commit 21d584b into ding113:feat/timeout-settings Nov 14, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

流式请求下,供应商失败快速重试

2 participants