CaIon
e2037ad756
refactor: Introduce pre-consume quota and unify relay handlers
...
This commit introduces a major architectural refactoring to improve quota management, centralize logging, and streamline the relay handling logic.
Key changes:
- **Pre-consume Quota:** Implements a new mechanism to check and reserve user quota *before* making the request to the upstream provider. This ensures more accurate quota deduction and prevents users from exceeding their limits due to concurrent requests.
- **Unified Relay Handlers:** Refactors the relay logic to use generic handlers (e.g., `ChatHandler`, `ImageHandler`) instead of provider-specific implementations. This significantly reduces code duplication and simplifies adding new channels.
- **Centralized Logger:** A new dedicated `logger` package is introduced, and all system logging calls are migrated to use it, moving this responsibility out of the `common` package.
- **Code Reorganization:** DTOs are generalized (e.g., `dalle.go` -> `openai_image.go`) and utility code is moved to more appropriate packages (e.g., `common/http.go` -> `service/http.go`) for better code structure.
2025-08-14 20:05:06 +08:00
Xyfacai
456475d593
refactor: format api page query and err result
2025-07-14 22:03:22 +08:00
CaIon
20607b0b5c
✨ feat(logs): add multi-key support in LogsTable and enhance log info generation
2025-07-12 15:14:55 +08:00
CaIon
cd8c23c0ab
✨ feat(channel): enhance channel status management
2025-07-10 17:49:53 +08:00
CaIon
7e298f8ad1
✨ feat: refactor environment variable initialization and introduce new constant types for API and context keys
2025-07-03 13:10:25 +08:00
skynono
4a313a5f93
feat: add moonshot(kimi) update balance
2025-06-05 18:16:37 +08:00
tbphp
7192437863
fix: 修改命名规范
2025-05-09 00:20:26 +08:00
tbphp
4bbcb00d13
feat: update OpenRouter balance
2025-05-09 00:15:44 +08:00
mango
fc33f2f0a5
feat(channel balance): add channel balance for siliconflow and deepseek
2025-01-07 12:15:55 +08:00
CaIon
37c0c8ebdd
feat: 初步兼容midjourney-proxy-plus
2024-03-13 15:37:01 +08:00
CaIon
d53d3386e9
feat: support ollama ( close #112 )
2024-03-12 02:36:39 +08:00
1808837298@qq.com
5b18cd6b0a
feat: 初步重构
2024-02-29 01:08:18 +08:00
CaIon
7dc8b0ea93
更新渠道管理
2023-12-05 18:15:40 +08:00
JustSong
159b9e3369
fix: fix unable to set zero value for base url & model mapping
2023-09-18 22:07:17 +08:00
JustSong
3da119efba
perf: reuse http client to reduce delay
2023-07-23 15:18:58 +08:00
ckt
dccd66b852
feat: add access_until field for subscription api ( #295 )
...
* 支持从计费渠道端点返回日期
* fix: fix wrong git base
---------
Co-authored-by: JustSong <songquanpeng@foxmail.com >
2023-07-23 13:49:09 +08:00
Cross Fire
d383302e8a
feat: support balance query for CloseAI ( #240 )
...
* 增加CloseAI余额查询功能
* 去除debug代码
* fix: bug fix
* docs: update README
---------
Co-authored-by: sudongyang <sudongyang@xiaomi.com >
Co-authored-by: JustSong <songquanpeng@foxmail.com >
2023-07-03 20:43:42 +08:00
Alone88
b1b3651e84
feat: support channel type AIGC2D ( #220 )
...
* feat: add AIGC2D Channel
* chore: remove console logging & update balance rendering
---------
Co-authored-by: Alone88 <im@aloen88.cn >
Co-authored-by: JustSong <songquanpeng@foxmail.com >
2023-06-29 21:34:17 +08:00
JustSong
4463224f04
feat: support automatic channel testing & balance updates ( close #11 , close #59 )
2023-06-22 22:01:03 +08:00
JustSong
dc94765d32
fix: do not print response to console
2023-06-18 00:22:22 +08:00
Kidultx
a43b1e2add
feat: support API2GPT platform ( #173 )
...
* support API2GPT platform
* chore: update balance renderer
---------
Co-authored-by: JustSong <songquanpeng@foxmail.com >
2023-06-17 15:20:51 +08:00
Joe
b7d71b4f0a
feat: support update AIProxy balance ( #171 )
...
* Add: support update AIProxy balance
* fix auth header
* chore: update balance renderer
---------
Co-authored-by: JustSong <songquanpeng@foxmail.com >
2023-06-17 10:08:04 +08:00
quzard
47ca449e32
feat: add support for updating balance of channel typpe OpenAI-SB ( #146 , close #125 )
...
* Add support for updating channel balance in OpenAISB
* fix: handel error
---------
Co-authored-by: JustSong <songquanpeng@foxmail.com >
2023-06-11 21:04:41 +08:00
JustSong
145bb14cb2
fix: fix not using proxy when update balance
2023-06-09 18:57:27 +08:00
JustSong
1e1c6a828f
fix: prompt user the feat is not implemented ( #125 )
2023-06-03 11:09:14 +08:00
JustSong
98f1a627f0
fix: fix balance query ( close #138 )
2023-06-03 10:17:52 +08:00
JustSong
333e4216d2
fix: fix balance query ( close #138 )
2023-06-03 10:11:59 +08:00
JustSong
f9f42997b2
chore: only check OpenAI channel & custom channel
2023-05-23 10:00:36 +08:00
JustSong
d4794fc051
feat: return user's quota with billing api ( close #92 )
2023-05-22 17:10:31 +08:00
JustSong
17b7646c12
fix: fix unable to update custom channel's balance
2023-05-21 20:10:06 +08:00
JustSong
171b818504
feat: support channel remain quota query ( close #79 )
2023-05-21 16:09:54 +08:00