16 Commits

Author SHA1 Message Date
CaIon
6175f254a2 refactor(channel_select): enhance retry logic and context key usage for channel selection 2025-12-13 16:43:38 +08:00
CaIon
413968a0fd refactor(relay): update channel retrieval to use RelayInfo structure 2025-12-12 22:04:38 +08:00
CaIon
758cd2c15f refactor(group): update user group handling to utilize userUsableGroups directly and add GetUserGroupRatio function 2025-10-30 21:16:42 +08:00
Seefs
5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 2025-10-11 15:30:09 +08:00
CaIon
c9e9a24e99 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
b555ac092d fix: playground group 2025-08-08 11:59:04 +08:00
Xyfacai
9055698b4f feat: 显式指定 error 跳过重试 2025-07-30 22:35:31 +08:00
CaIon
c773584ecd fix: 修复playground优先级失效 2025-07-17 22:26:38 +08:00
feitianbubu
79522d7688 fix: playground chat 2025-07-16 23:47:59 +08:00
CaIon
4a9ca4209a refactor: Introduce standardized API error
This commit refactors the application's error handling mechanism by introducing a new standardized error type, `types.NewAPIError`. It also renames common JSON utility functions for better clarity.

Previously, internal error handling was tightly coupled to the `dto.OpenAIError` format. This change decouples the internal logic from the external API representation.

Key changes:
- A new `types.NewAPIError` struct is introduced to serve as a canonical internal representation for all API errors.
- All relay adapters (OpenAI, Claude, Gemini, etc.) are updated to return `*types.NewAPIError`.
- Controllers now convert the internal `NewAPIError` to the client-facing `OpenAIError` format at the API boundary, ensuring backward compatibility.
- Channel auto-disable/enable logic is updated to use the new standardized error type.
- JSON utility functions are renamed to align with Go's standard library conventions (e.g., `UnmarshalJson` -> `Unmarshal`, `EncodeJson` -> `Marshal`).
2025-07-10 15:02:40 +08:00
CaIon
cf11a22c3a 🔧 refactor(auth, channel, context): improve context setup and validation for multi-key channels 2025-07-06 12:37:56 +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
d93204e8d8 fix: playground write user context to check acceptUnsetRatio 2025-06-18 11:06:15 +08:00
creamlike1024
c6a9df67b1 feat: auto分组 2025-06-16 22:15:12 +08:00
CalciumIon
dfa3f661a5 fix: playground request_start_time 2024-12-29 01:03:02 +08:00
CalciumIon
46fcb691d5 refactor: Playground controller 2024-12-28 16:47:56 +08:00