Commit Graph

17 Commits

Author SHA1 Message Date
CaIon
6748b006b7 refactor: centralize logging and update resource initialization
This commit refactors the logging mechanism across the application by replacing direct logger calls with a centralized logging approach using the `common` package. Key changes include:

- Replaced instances of `logger.SysLog` and `logger.FatalLog` with `common.SysLog` and `common.FatalLog` for consistent logging practices.
- Updated resource initialization error handling to utilize the new logging structure, enhancing maintainability and readability.
- Minor adjustments to improve code clarity and organization throughout various modules.

This change aims to streamline logging and improve the overall architecture of the codebase.
2025-08-14 21:10:04 +08:00
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
CalciumIon
6625563f80 feat: Enhance quota data handling and CSS styling
- Updated the `increaseQuotaData` function to include `tokenUsed` parameter for better quota tracking.
- Modified the `GetAllQuotaDates` function to sum `token_used` alongside `count` and `quota` for comprehensive data retrieval.
- Improved CSS styles for better layout responsiveness, including padding adjustments for navigation elements and description cards.
2024-12-12 16:18:14 +08:00
CaIon
5715fcf8fb feat: add pricing page 2024-05-13 23:02:35 +08:00
1808837298@qq.com
912f46fcd2 feat: 记录请求的token用量 2024-03-04 14:58:30 +08:00
CaIon
f07b9f8ab2 chore: cache username 2024-01-11 18:40:44 +08:00
CaIon
1618a8c9fc perf: 优化数据看板性能 2024-01-09 16:20:04 +08:00
CaIon
6ed365c267 fix: 修复数据看板筛选用户的时候不能指定时间的问题 2024-01-09 12:11:09 +08:00
CaIon
95e84f2bb1 perf: 优化数据看板性能和显示效果 2024-01-08 18:49:10 +08:00
CaIon
8f36a995ef perf: 美化数据看板 2024-01-08 11:32:27 +08:00
CaIon
f3124e7252 fix: 减少username和model_name字段长度为64 2024-01-08 10:11:36 +08:00
CaIon
a5e0f86c65 fix: 索引长度 2024-01-07 22:16:20 +08:00
CaIon
2a995a5da2 fix: 索引名称长度 2024-01-07 22:07:17 +08:00
CaIon
bba6174745 fix: fix gemini panic 2024-01-07 21:27:28 +08:00
CaIon
1c2bba8979 feat: 完善数据看板选择时间区间 2024-01-07 19:47:35 +08:00
CaIon
ce05e7dd86 fix: 优化数据看板更新逻辑 2024-01-07 18:33:41 +08:00
CaIon
bf8794d257 feat: 新增数据看板 2024-01-07 18:31:14 +08:00