Calcium-Ion
877529ef6b
Merge pull request #1120 from neotf/feat-04
...
feat: enhance token usage details for upstream OpenRouter
2025-06-22 01:10:49 +08:00
CaIon
16997a695d
refactor: token counter logic
2025-06-21 00:54:40 +08:00
neotf
984152c772
fix(quota): refine cache token calculation for OpenRouter channel type
2025-06-18 20:11:48 +08:00
Apple\Apple
175ea56fdd
🚚 Refactor(ratio_setting): refactor ratio management into standalone ratio_setting package
...
Summary
• Migrated all ratio-related sources into `setting/ratio_setting/`
– `model_ratio.go` (renamed from model-ratio.go)
– `cache_ratio.go`
– `group_ratio.go`
• Changed package name to `ratio_setting` and relocated initialization (`ratio_setting.InitRatioSettings()` in main).
• Updated every import & call site:
– Model / cache / completion / image ratio helpers
– Group ratio helpers (`GetGroupRatio*`, `ContainsGroupRatio`, `CheckGroupRatio`, etc.)
– JSON-serialization & update helpers (`*Ratio2JSONString`, `Update*RatioByJSONString`)
• Adjusted controllers, middleware, relay helpers, services and models to reference the new package.
• Removed obsolete `setting` / `operation_setting` imports; added missing `ratio_setting` imports.
• Adopted idiomatic map iteration (`for key := range m`) where value is unused.
• Ran static checks to ensure clean build.
This commit centralises all ratio configuration (model, cache and group) in one cohesive module, simplifying future maintenance and improving code clarity.
2025-06-18 18:00:49 +08:00
neotf
c787f59822
Merge branch 'main' into feat-04
2025-06-18 15:20:24 +08:00
CaIon
d4e20df7a6
fix(relay): refine error message for unsupported MIME types and enhance error handling in OpenAI wrapper
2025-06-17 22:44:57 +08:00
CaIon
8d0b54bf6e
fix(relay): improve error handling for unsupported MIME types by sanitizing URLs
2025-06-17 22:40:41 +08:00
CaIon
5506e4feed
feat(file_decoder): expand MIME type detection to include additional file extensions
2025-06-17 22:20:19 +08:00
CaIon
16bffe05d4
feat(file_decoder): add debug logging for MIME type detection when handling application/octet-stream
2025-06-17 22:18:51 +08:00
CaIon
680ff8e8eb
feat(file_decoder): enhance MIME type detection based on URL and Content-Disposition header
2025-06-17 21:49:13 +08:00
Calcium-Ion
129d1b081f
Merge pull request #1239 from QuantumNous/auto_group
...
feat: auto分组
2025-06-17 21:14:09 +08:00
CaIon
4ec7012974
✨ feat: enhance group ratio handling in pricing calculations
2025-06-17 21:05:35 +08:00
CaIon
822ed681de
feat(channel): add handling for pre_consume_token_quota_failed error type
2025-06-17 16:46:52 +08:00
creamlike1024
c6a9df67b1
feat: auto分组
2025-06-16 22:15:12 +08:00
CaIon
c4e652461e
🔧 refactor(dto): update BudgetTokens handling in Thinking struct
2025-06-16 18:29:49 +08:00
Calcium-Ion
158d621fd7
Merge pull request #1207 from QuantumNous/user_group_ratio
...
feat: 分组特殊倍率
2025-06-13 01:25:46 +08:00
creamlike1024
2a0bf7f991
feat: 分组特殊倍率
2025-06-11 23:46:59 +08:00
neotf
1cff048cb7
Merge branch 'main' into feat-04
2025-06-11 13:55:47 +08:00
CaIon
5511ba3670
🔧 fix(stream_scanner): improve resource management and error handling in StreamScannerHandler
2025-06-11 00:18:16 +08:00
CaIon
7dc7805c6a
🔧 fix(token_counter): enhance token encoder caching and concurrency handling
2025-06-10 18:55:21 +08:00
CaIon
1abd77c17c
🔧 fix(token_counter): refactor token encoder initialization and retrieval logic
2025-06-10 18:51:26 +08:00
CaIon
88a801af2d
🔧 fix(token_counter): update token encoder implementation and dependencies
2025-06-10 18:04:49 +08:00
Xyfacai
8343fe0740
refactor: message content 改成 any
...
refactor: message content 改成 any
2025-06-07 23:47:22 +08:00
creamlike1024
0e9a193ed8
feat: gemini audio input billing
2025-06-07 12:26:23 +08:00
neotf
1ce5c34703
Merge branch 'main' into feat-04
2025-06-05 20:35:47 +08:00
neotf
a813b24184
feat: support claude cache and thinking for upstream [OpenRouter] ( #983 )
...
* feat: support claude cache for upstream [OpenRouter]
* feat: support claude thinking for upstream [OpenRouter]
* feat: reasoning is common params for OpenRouter
2025-06-05 17:35:48 +08:00
neotf
dde8c49a2e
feat: enhance cache_create_tokens calculation for OpenRouter
2025-05-29 22:47:02 +08:00
neotf
c0df38767c
feat: enhance token usage details for upstream OpenRouter
2025-05-29 00:55:57 +08:00
CaIon
c0d85e2d98
feat: enhance image decoding logic to handle base64 file types and improve error handling
2025-05-15 14:51:33 +08:00
creamlike1024
5c53f48a86
feat: add support for socks5h
2025-05-11 17:00:33 +08:00
creamlike1024
285c4a7e4c
feat: add option to allow worker HTTP image requests
2025-05-09 02:00:42 +08:00
CaIon
4bf0d094c4
feat: add video URL support in MediaContent and update token counting logic
2025-05-03 21:12:07 +08:00
CaIon
b364e9e3b1
refactor: simplify model prefix checks and update message role for o-series models
2025-04-17 16:50:52 +08:00
neotf
935cc1c605
fix: wrong systemStr for Claude (OpenAI Upstream)
2025-04-14 01:09:02 +08:00
CaIon
74d9bb1a12
feat: enhance Claude to OpenAI request conversion with additional relay info support
2025-04-11 19:13:38 +08:00
CaIon
9e4506ebaf
feat: 完善openai转claude支持
2025-04-11 18:28:50 +08:00
CaIon
577b18a1a1
feat: enhance file handling and logging in the application
2025-04-11 16:23:54 +08:00
CaIon
7e0d4cd055
refactor: move maxFileSize variable inside GetFileBase64FromUrl function
2025-04-11 15:53:23 +08:00
1808837298@qq.com
5e06085744
refactor: Improve token quota consumption logic
2025-03-17 17:52:54 +08:00
1808837298@qq.com
62dc82638d
feat: Introduce JSON decoding utility functions and update error handling in Claude and OpenAI response structures
2025-03-16 18:34:39 +08:00
1808837298@qq.com
b93827c425
feat: support dify upload image file
2025-03-15 19:10:12 +08:00
1808837298@qq.com
47c297794d
feat: 初步兼容流模式下openai渠道类型转为claude格式访问 #862
2025-03-13 19:32:08 +08:00
1808837298@qq.com
78fc3a191c
feat: claude relay
2025-03-12 21:31:46 +08:00
1808837298@qq.com
0db072de86
feat(error): Enhance error handling with optional detailed error messages
2025-03-11 17:25:06 +08:00
1808837298@qq.com
0876bc3f7f
feat: Improve decimal precision for quota and payment calculations
...
- Added github.com/shopspring/decimal for precise floating-point calculations
- Refactored quota and payment calculations in multiple files to use decimal arithmetic
- Updated go.mod and go.sum to include decimal library
- Improved precision in topup, relay, and quota service calculations
- Added support for more OpenAI model variants in cache ratio settings
2025-03-08 21:55:50 +08:00
1808837298@qq.com
5bed29e2bd
refactor: Improve quota calculation precision using floating-point arithmetic
2025-03-08 16:44:08 +08:00
1808837298@qq.com
b640118d74
feat: Implement cache token ratio for more precise token pricing
2025-03-08 01:30:50 +08:00
1808837298@qq.com
783c60ee4d
feat: Enhance channel status update with success tracking and dynamic notification #812
2025-03-06 17:46:03 +08:00
1808837298@qq.com
063618e256
fix: Handle error in NotifyRootUser and log system errors #812
2025-03-06 17:25:39 +08:00
1808837298@qq.com
7cec111b1f
fix: error NotifyRootUser #812
2025-03-06 15:56:42 +08:00