Commit Graph

498 Commits

Author SHA1 Message Date
Seefs
1ae853824f Merge pull request #2745 from mehunk/feat/custom-stripe-url
feat: Support customizing the success and cancel url of Stripe.
2026-02-02 13:15:05 +08:00
Calcium-Ion
d7c55b92b2 feat: disk request body cache (#2780)
* feat: 引入通用 HTTP BodyStorage/DiskCache 缓存配置与管理

- 新增 common/body_storage.go 提供 HTTP 请求体存储抽象和文件缓存能力
- 增加 common/disk_cache_config.go 支持全局磁盘缓存配置
- main.go 挂载缓存初始化流程
- 新增和补充 controller/performance.go (及 unix/windows) 用于缓存性能监控接口
- middleware/body_cleanup.go 自动清理缓存文件
- router 挂载相关接口
- 前端 settings 页面新增性能监控设置 PerformanceSetting
- 优化缓存开关状态和模块热插拔能力
- 其他相关文件同步适配缓存扩展

* fix: 修复 BodyStorage 并发安全和错误处理问题

- 修复 diskStorage.Close() 竞态条件,先获取锁再执行 CAS
- 为 memoryStorage 添加互斥锁和 closed 状态检查
- 修复 CreateBodyStorageFromReader 在磁盘存储失败时的回退逻辑
- 添加缓存命中统计调用 (IncrementDiskCacheHits/IncrementMemoryCacheHits)
- 修复 gin.go 中 Seek 错误被忽略的问题
- 在 api-router 添加 BodyStorageCleanup 中间件
- 修复前端 formatBytes 对异常值的处理

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-30 01:00:49 +08:00
mehunk
db5b07bf98 feat: Add trusted redirect domains. 2026-01-26 22:18:04 +09:00
Seefs
cf114ca7d6 feat: openai response /v1/response/compact (#2644)
* feat: openai response /v1/response/compact

* feat: /v1/response/compact bill

* feat: /v1/response/compact

* feat: /v1/responses/compact -> codex channel

* feat: /v1/responses/compact -> codex channel

* feat: /v1/responses/compact -> codex channel

* feat: codex channel default models

* feat: compact model price

* feat: /v1/responses/comapct test
2026-01-26 20:20:16 +08:00
Seefs
9ac94f036c fix: test using the correct path for rerank (#2736)
* fix: test using the correct path for rerank.

* fix: The `input` parameter for testing responses uses an array to accommodate certain channels, such as Codex, which are incompatible with single strings.
2026-01-26 19:57:15 +08:00
feitianbubu
21c0a51dc3 feat: requestId time string use UTC 2026-01-22 08:58:35 +08:00
Seefs
980af061fd feat: TLS_INSECURE_SKIP_VERIFY env 2026-01-15 14:43:53 +08:00
Seefs
2a15e3b152 feat: codex channel (#2652)
* feat: codex channel

* feat: codex channel

* feat: codex oauth flow

* feat: codex refresh cred

* feat: codex usage

* fix: codex err message detail

* fix: codex setting ui

* feat: codex refresh cred task

* fix: import err

* fix: codex store must be false

* fix: chat -> responses tool call

* fix: chat -> responses tool call
2026-01-14 22:29:43 +08:00
Xyfacai
389ddfa8a9 Merge pull request #2590 from xyfacai/fix/max-body-limit
fix: 设置默认max req body 为128MB
2026-01-06 21:47:12 +08:00
xiangsx
3c21652e28 feat: add regex pattern to mask API keys in sensitive information 2026-01-05 22:44:11 +08:00
CaIon
04ff3df583 fix(gin): update request body size check to allow zero limit 2026-01-05 18:55:24 +08:00
CaIon
75a6a0ba2b feat(init): increase maximum file download size to 64MB 2025-12-31 21:15:37 +08:00
Seefs
b10aed74b2 Merge branch 'upstream-main' into feature/pyro 2025-12-25 17:08:02 +08:00
CaIon
c2a6193497 feat(gin): improve request body handling and error reporting 2025-12-20 13:34:10 +08:00
CaIon
3523acfc2c feat(init): increase MaxRequestBodyMB to enhance request handling 2025-12-20 13:27:55 +08:00
Seefs
a78fd2dae6 docs: document pyroscope env var 2025-12-19 23:16:56 +08:00
Seefs
fb0ffe8c95 docs: document pyroscope env var 2025-12-19 23:03:04 +08:00
Seefs
b49bb48ed1 fix: systemname 2025-12-19 22:27:35 +08:00
t0ng7u
fa814b80fe 🧹 fix: harden request-body size handling and error unwrapping
Tighten oversized request handling across relay paths and make error matching reliable.

- Align `MAX_REQUEST_BODY_MB` fallback to `32` in request body reader and decompression middleware
- Stop ignoring `GetRequestBody` errors in relay retry paths; return consistent **413** on oversized bodies (400 for other read errors)
- Add `Unwrap()` to `types.NewAPIError` so `errors.Is/As` can match wrapped underlying errors
- `go test ./...` passes
2025-12-16 18:10:00 +08:00
t0ng7u
c2ed76ddfd 🛡️ fix: prevent OOM on large/decompressed requests; skip heavy prompt meta when token count is disabled
Clamp request body size (including post-decompression) to avoid memory exhaustion caused by huge payloads/zip bombs, especially with large-context Claude requests. Add a configurable `MAX_REQUEST_BODY_MB` (default `32`) and document it.

- Enforce max request body size after gzip/br decompression via `http.MaxBytesReader`
- Add a secondary size guard in `common.GetRequestBody` and cache-safe handling
- Return **413 Request Entity Too Large** on oversized bodies in relay entry
- Avoid building large `TokenCountMeta.CombineText` when both token counting and sensitive check are disabled (use lightweight meta for pricing)
- Update READMEs (CN/EN/FR/JA) with `MAX_REQUEST_BODY_MB`
- Fix a handful of vet/formatting issues encountered during the change
- `go test ./...` passes
2025-12-16 17:00:19 +08:00
CaIon
947a763a1a feat(auth): enhance IP restriction handling with CIDR support 2025-12-15 17:24:09 +08:00
CaIon
1bd0d8de02 Revert "feat(audio): replace SysLog with logger for improved logging in GetAudioDuration"
This reverts commit 2a980bbcf5.
2025-12-14 00:04:40 +08:00
CaIon
2a980bbcf5 feat(audio): replace SysLog with logger for improved logging in GetAudioDuration 2025-12-13 23:59:58 +08:00
CaIon
da0d3ea93c fix(audio): improve WAV duration calculation with enhanced PCM size handling 2025-12-13 23:57:32 +08:00
Seefs
bdfc875775 feat: pyroscope integrate 2025-12-13 13:49:38 +08:00
zhiheng.wang
8279be2380 fix: correct sender format issues
- Adjust sender field format, add space to separate nickname and email address
- Ensure email header format complies with standard RFC specifications
- Fix potential email client sending exceptions (Tencent Cloud)
2025-12-12 16:19:14 +08:00
Calcium-Ion
3676b9f2bc Merge pull request #2358 from seefs001/fix/regrex-repeat-compile
fix: regex repeat compile
2025-12-09 14:01:07 +08:00
CaIon
ea3e9a01a0 feat: 将任务查询数量改为可配置环境变量 TASK_QUERY_LIMIT 2025-12-03 19:27:15 +08:00
Seefs
1dd8c0f569 fix: regex repeat compile 2025-12-03 00:41:47 +08:00
Calcium-Ion
cb40004d86 Merge pull request #2355 from QuantumNous/feat/optimize-token-counter
feat: refactor token estimation logic
2025-12-02 21:51:09 +08:00
CaIon
1fededceb3 feat: refactor token estimation logic
- Introduced new OpenAI text models in `common/model.go`.
- Added `IsOpenAITextModel` function to check for OpenAI text models.
- Refactored token estimation methods across various channels to use estimated prompt tokens instead of direct prompt token counts.
- Updated related functions and structures to accommodate the new token estimation approach, enhancing overall token management.
2025-12-02 21:34:39 +08:00
Papersnake
14622aede6 fix: set MaxIdleConnsPerHost to 100 2025-12-02 09:55:03 +08:00
Seefs
594075bfdc fix: nano banana pro 4k(StreamScannerMaxBufferMB env) 2025-11-30 16:08:25 +08:00
Seefs
a1050f697f Merge pull request #2261 from wzxjohn/hotfix/analytic
fix: root page does not have analytic code
2025-11-24 14:06:02 +08:00
Calcium-Ion
ff31f7df1a Merge pull request #2278 from seefs001/fix/release-version
fix: release workflow show version
2025-11-23 23:51:32 +08:00
Seefs
de4b52d320 fix: release workflow show version 2025-11-22 20:06:13 +08:00
CaIon
5a037f2acd feat: Add CountToken configuration and update token counting logic 2025-11-22 17:15:34 +08:00
CaIon
4dbbf06adc fix: Update GET_MEDIA_TOKEN_NOT_STREAM default value to false 2025-11-22 16:23:37 +08:00
Seefs
99055bab25 fix: boundary parser error (error parsing multipart form: multipart: NextPart: bufio: buffer full) 2025-11-16 14:09:10 +08:00
Sh1n3zZ
af671d34c3 feat: replicate channel flux model 2025-11-08 01:24:45 +08:00
Leon
71c26a5843 feat: add environment variable switch for critical rate limit 2025-11-06 15:23:34 +08:00
Seefs
a98e207ef7 feat: add ali wan video (#2141)
* feat: add ali wan video

* refactor: use same UnmarshalBodyReusable

* feat: enhance request body metadata

* feat: opt wan convertToOpenAIVideo

* feat: add wan support other param via json metadata

* refactor: remove unused code

* fix ali

---------

Co-authored-by: feitianbubu <feitianbubu@qq.com>
2025-10-31 16:51:05 +08:00
wzxjohn
24cdd6bbf1 fix: typo 2025-10-30 14:21:46 +08:00
wzxjohn
da97c8ecc3 fix(web): index page does not have analytic 2025-10-30 12:17:51 +08:00
CaIon
602a92849c fix(audio): add support for .opus files in audio duration calculation 2025-10-29 22:47:39 +08:00
CaIon
bbdc57c18c refactor(channel_cache): improve channel selection logic by handling zero total weight and removing unnecessary variable 2025-10-29 21:49:06 +08:00
CaIon
a00c6393c5 feat: implement audio duration retrieval without ffmpeg dependencies 2025-10-28 15:50:45 +08:00
feitianbubu
fe9b092b0b feat: doubao-seedream support image edit 2025-10-23 21:19:33 +08:00
feitianbubu
a2d34b9e47 feat: add minimax api adaptor 2025-10-20 16:26:50 +08:00
CaIon
8ff87ae6c2 feat: add temporary TASK_PRICE_PATCH configuration to environment variables 2025-10-16 21:59:21 +08:00