Commit Graph

203 Commits

Author SHA1 Message Date
CaIon 9ab5df9398 fix: remove redundant error message details for channel retrieval failures 2025-10-14 13:53:33 +08:00
Seefs 5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 2025-10-11 15:30:09 +08:00
feitianbubu 06ae3efa19 feat: add openai sdk create 2025-10-11 02:44:01 +08:00
feitianbubu 94b68c2b63 feat: add sora video fetch task 2025-10-10 15:25:29 +08:00
feitianbubu 0d0e4f5333 fix: avoid get model consuming body 2025-10-10 14:19:49 +08:00
feitianbubu 1d1759aaae feat: add sora video submit task 2025-10-09 15:00:02 +08:00
Seefs f8c9763a64 Merge branch 'alpha' into pr/fix-video-get-task 2025-10-02 14:43:11 +08:00
Seefs 8eace6bb62 feat: 通用二步验证 2025-09-30 12:12:50 +08:00
Seefs 8d32b08d44 Merge branch 'alpha' into feat-vertex-veo 2025-09-13 13:10:39 +08:00
feitianbubu 8da06d5473 fix: get video task err when Content-Type=json 2025-09-11 12:53:19 +08:00
t0ng7u ed71c9fcf3 🎨 style(go): format entire codebase
- Apply canonical Go formatting to all .go files
- No functional changes; whitespace/import/struct layout only
- Improves consistency, reduces diff noise, and aligns with standard tooling
2025-08-31 13:08:34 +08:00
Sh1n3zZ cf8b021b61 feat: vertex veo (#1450) 2025-08-27 18:06:47 +08:00
creamlike1024 d6fcc7a51d feat: add disable cache middleware 2025-08-27 01:30:01 +08:00
CaIon 781a708173 feat: support qwen-image-edit 2025-08-25 14:33:12 +08:00
Nekohy 2d1512096a feats:add custom headers override 2025-08-24 01:02:23 +08:00
CaIon 893104a173 refactor: move anthropicKey retrieval to improve authorization handling 2025-08-15 16:08:55 +08:00
CaIon e0f256506f Merge branch 'alpha' into refactor_relay
# Conflicts:
#	dto/openai_image.go
2025-08-15 13:46:34 +08:00
CaIon 013b30c228 refactor: enhance error handling and masking for model not found scenarios 2025-08-15 12:41:05 +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 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
CaIon b850f94139 fix(auth): refine authorization header setting for messages endpoint #1575 2025-08-12 20:42:44 +08:00
IcedTangerine 9717af7dcd Merge pull request #1553 from feitianbubu/pr/add-jimeng-officail-api
feat: add jimeng video official api
2025-08-12 16:32:49 +08:00
Calcium-Ion 23d4100fe3 Merge pull request #1556 from QuantumNous/fix-register-mail-verifycode-waiting-time
fix: 注册时发送邮件验证码没有等待时间
2025-08-12 14:20:09 +08:00
creamlike1024 46cd3f4071 feat(middleware): redis atomic incr, show waiting time 2025-08-10 23:18:09 +08:00
Seefs 3b6d0d0291 Merge pull request #1547 from seefs001/feature/model_list
 feat: Enhance model listing and retrieval with support for Anthropic and Gemini models; refactor routes for better API key handling
2025-08-10 22:57:20 +08:00
creamlike1024 ff2e0dbc26 feat(middleware): add email verification rate limit 2025-08-10 21:22:53 +08:00
CaIon 8907e5cf6d feat: Add ChannelOtherSettings to manage additional channel configurations 2025-08-10 20:21:30 +08:00
feitianbubu 73609f50d0 feat: add jimeng video official api 2025-08-10 16:54:44 +08:00
nekohy 4cf1ffa801 feat: Enhance model listing and retrieval with support for Anthropic and Gemini models; refactor routes for better API key handling 2025-08-10 11:44:38 +08:00
CaIon 05af05e449 feat: add system prompt override functionality in channel settings and request handling #1468 2025-08-09 12:53:06 +08:00
CaIon b555ac092d fix: playground group 2025-08-08 11:59:04 +08:00
Xyfacai 15c11bfe51 refactor: 调整模型匹配 2025-08-06 20:09:22 +08:00
CaIon 0080123779 fix: ensure ChannelIsMultiKey context key is set to false for single key retries 2025-08-01 18:09:20 +08:00
Xyfacai 9055698b4f feat: 显式指定 error 跳过重试 2025-07-30 22:35:31 +08:00
CaIon 2cb7b9ae62 fix: improve error messaging and JSON schema handling in distributor and relay components 2025-07-26 12:11:20 +08:00
feitianbubu d10c7a3548 fix: playground chat vip group 2025-07-24 09:38:00 +08:00
CaIon 127d1d692f fix(distributor): add validation for model name in channel selection 2025-07-23 16:46:06 +08:00
CaIon 5418bb3b7c fix: improve error messages for channel retrieval failures in distributor and relay 2025-07-23 16:32:52 +08:00
feitianbubu b3c4d97286 chore: opt video channel and platform 2025-07-22 20:14:24 +08:00
t0ng7u d2ef70f6b0 feat(kling): send both model_name and model fields for upstream compatibility
Some upstream Kling deployments still expect the legacy `model` key
instead of `model_name`.
This change adds the `model` field to `requestPayload` and populates it
with the same value as `model_name`, ensuring the generated JSON works
with both old and new versions.

Changes:
• Added `Model string "json:\"model,omitempty\""` to `requestPayload`
• Set `Model` alongside `ModelName` in `convertToRequestPayload`
• Updated comments to clarify compatibility purpose

Result:
Kling task requests now contain both `model_name` and `model`, removing
integration issues with upstreams that only recognize one of the keys.
2025-07-22 01:21:56 +08:00
t0ng7u 200faadb4a feat(middleware): enhance Kling request adapter to support both 'model' and 'model_name' fields
Previously, the KlingRequestConvert middleware only extracted model name from
the 'model_name' field, which caused 503 errors when requests used the 'model'
field instead. This enhancement improves API compatibility by supporting both
field names.

Changes:
- Modified KlingRequestConvert() to check for 'model' field if 'model_name' is empty
- Maintains backward compatibility with existing 'model_name' usage
- Fixes "no available channels for model" error when model field was not recognized

This resolves issues where valid Kling API requests were failing due to field
name mismatches, improving the overall user experience for video generation APIs.
2025-07-22 00:06:29 +08:00
Calcium-Ion 4a46b50e90 Merge pull request #1349 from feitianbubu/pr/fix-kling-image-mode-name
fix: KlingText2VideoRequest image and model_name
2025-07-18 20:47:10 +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 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
skynono fec1016c97 fix: KlingText2VideoRequest image and model_name
feat: add video channel kling swag
2025-07-09 07:34:04 +00:00
Xiangyuan-liu db98c0f4b1 refactor: log params and channel params
refactor: log params and channel params
2025-07-07 14:26:37 +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