CaIon
97ea8b6560
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
38c5e0e9f4
refactor: format api page query and err result
2025-07-14 22:03:22 +08:00
CaIon
9881bfc3c9
✨ feat(logs): add multi-key support in LogsTable and enhance log info generation
2025-07-12 15:14:55 +08:00
CaIon
8e11b67ece
✨ feat(channel): enhance channel status management
2025-07-10 17:49:53 +08:00
CaIon
f14f4eaf1a
✨ feat: refactor environment variable initialization and introduce new constant types for API and context keys
2025-07-03 13:10:25 +08:00
skynono
3e3b1d0ae3
feat: add moonshot(kimi) update balance
2025-06-05 18:16:37 +08:00
tbphp
3f3672124d
fix: 修改命名规范
2025-05-09 00:20:26 +08:00
tbphp
d6942dfe06
feat: update OpenRouter balance
2025-05-09 00:15:44 +08:00
mango
d5e5b856dc
feat(channel balance): add channel balance for siliconflow and deepseek
2025-01-07 12:15:55 +08:00
CaIon
259c7fcdb0
feat: 初步兼容midjourney-proxy-plus
2024-03-13 15:37:01 +08:00
CaIon
c1537aad3c
feat: support ollama ( close #112 )
2024-03-12 02:36:39 +08:00
1808837298@qq.com
1735981217
feat: 初步重构
2024-02-29 01:08:18 +08:00
CaIon
f9495e91ea
更新渠道管理
2023-12-05 18:15:40 +08:00
JustSong
1661d34f7b
fix: fix unable to set zero value for base url & model mapping
2023-09-18 22:07:17 +08:00
JustSong
a989fef50c
perf: reuse http client to reduce delay
2023-07-23 15:18:58 +08:00
ckt
df026eff03
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
3b247077d2
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
244ca0351f
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
6bea2724e4
feat: support automatic channel testing & balance updates ( close #11 , close #59 )
2023-06-22 22:01:03 +08:00
JustSong
c54f70aebc
fix: do not print response to console
2023-06-18 00:22:22 +08:00
Kidultx
9f3c756a88
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
3e965dd5d4
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
ba95b357d1
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
d6931d059b
fix: fix not using proxy when update balance
2023-06-09 18:57:27 +08:00
JustSong
12fb3cb9f9
fix: prompt user the feat is not implemented ( #125 )
2023-06-03 11:09:14 +08:00
JustSong
b28b49bb79
fix: fix balance query ( close #138 )
2023-06-03 10:17:52 +08:00
JustSong
897fb9295d
fix: fix balance query ( close #138 )
2023-06-03 10:11:59 +08:00
JustSong
c658ce0a6c
chore: only check OpenAI channel & custom channel
2023-05-23 10:00:36 +08:00
JustSong
9fbba5a1b3
feat: return user's quota with billing api ( close #92 )
2023-05-22 17:10:31 +08:00
JustSong
e5a17e8ec7
fix: fix unable to update custom channel's balance
2023-05-21 20:10:06 +08:00
JustSong
128c84b338
feat: support channel remain quota query ( close #79 )
2023-05-21 16:09:54 +08:00