Commit Graph

107 Commits

Author SHA1 Message Date
Seefs
219b13af70 fix: 模型设置增加针对Vertex渠道过滤content[].part[].functionResponse.id的选项,默认启用 2025-12-21 17:09:49 +08:00
CaIon
e0a79e853d refactor(auth): replace direct token group setting with context key retrieval 2025-12-13 01:38:12 +08:00
CaIon
413968a0fd refactor(relay): update channel retrieval to use RelayInfo structure 2025-12-12 22:04:38 +08:00
CaIon
1fededceb3 feat: refactor token estimation logic
- Introduced new OpenAI text models in `common/model.go`.
- Added `IsOpenAITextModel` function to check for OpenAI text models.
- Refactored token estimation methods across various channels to use estimated prompt tokens instead of direct prompt token counts.
- Updated related functions and structures to accommodate the new token estimation approach, enhancing overall token management.
2025-12-02 21:34:39 +08:00
feitianbubu
aa2f027dea feat: add hailuo i2v fl2v r2v 2025-11-14 11:55:43 +08:00
Seefs
a98e207ef7 feat: add ali wan video (#2141)
* feat: add ali wan video

* refactor: use same UnmarshalBodyReusable

* feat: enhance request body metadata

* feat: opt wan convertToOpenAIVideo

* feat: add wan support other param via json metadata

* refactor: remove unused code

* fix ali

---------

Co-authored-by: feitianbubu <feitianbubu@qq.com>
2025-10-31 16:51:05 +08:00
Seefs
36b712437d fix veo3 (#2140) 2025-10-31 15:29:17 +08:00
CaIon
a25c11df2a feat: add support for Submodel channel type in relay info 2025-10-25 22:10:26 +08:00
creamlike1024
d493fffa3f feat: add support for Ali channel in streamSupportedChannels 2025-10-18 17:00:08 +08:00
CaIon
5069482d22 refactor: update ConvertToOpenAIVideo method to return byte array and improve error handling 2025-10-14 23:03:17 +08:00
feitianbubu
d724f25db4 refactor: add openaiVideo and method 2025-10-11 17:05:36 +08:00
feitianbubu
7c7313a937 feat: add jimeng use openai sdk 2025-10-11 17:05:33 +08:00
Seefs
5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 2025-10-11 15:30:09 +08:00
feitianbubu
c0859c056f feat: add openai sdk for kling 2025-10-11 02:43:56 +08:00
feitianbubu
69f497e350 refactor: openAI video use OpenAIVideoConverter 2025-10-11 02:43:43 +08:00
RedwindA
efdb1c5b46 fix(openai): account cached tokens for
zhipu_v4 usage
2025-10-08 16:52:49 +08:00
Calcium-Ion
6fd746a339 Merge pull request #1956 from QuantumNous/alpha
alpha -> main
2025-10-02 15:26:59 +08:00
Seefs
799de43cff fix: Return the original payload and nil error on Unmarshal or Marshal failures in RemoveDisabledFields 2025-10-02 13:57:49 +08:00
feitianbubu
3c796a1166 feat: add doubao video use quota by total token 2025-10-02 04:00:46 +08:00
Seefs
d075fbee23 fix: missing field & field control 2025-10-02 00:14:35 +08:00
Seefs
946da49721 fix: claude beta=true 2025-09-30 09:46:46 +08:00
feitianbubu
4db3aebb64 feat: jimeng video add images 2025-09-12 22:43:08 +08:00
feitianbubu
e55c84f599 refactor: use common taskSubmitReq 2025-09-12 22:43:03 +08:00
CaIon
f7c4eda0f3 Revert "refactor: replace DeepCopy with Copy for request handling consistency"
This reverts commit c21219fcff.
2025-08-28 15:11:55 +08:00
CaIon
c21219fcff refactor: replace DeepCopy with Copy for request handling consistency 2025-08-28 14:57:47 +08:00
creamlike1024
13d14dc8a8 Merge branch 'alpha' of github.com:iszcz/new-api into iszcz-alpha 2025-08-27 22:26:15 +08:00
CaIon
3e5bc637de fix: Invalid type for 'input[x].summary': expected an array of objects, but got null instead 2025-08-26 13:17:31 +08:00
iszcz
d904f9b486 task_relay_info 2025-08-25 18:01:10 +08:00
Nekohy
2d1512096a feats:add custom headers override 2025-08-24 01:02:23 +08:00
Calcium-Ion
12b9f0f560 Merge pull request #1635 from feitianbubu/pr/fix-task-info-channel-type
Pr/fix task info channel type
2025-08-23 13:46:52 +08:00
CaIon
1ee3d1cc50 feat: 修复重试后请求结构混乱,修复rerank端点无法使用 2025-08-23 13:12:15 +08:00
feitianbubu
184cdb5c28 fix: channel type nil point 2025-08-22 15:55:25 +08:00
CaIon
11ce48be47 feat: set API version for Azure and Vertex AI channel types 2025-08-16 14:56:19 +08:00
CaIon
e1d36932ae fix panic 2025-08-15 15:15:21 +08:00
CaIon
8eb17f24bb refactor: improve request type validation and enhance sensitive information masking 2025-08-15 13:20:36 +08:00
CaIon
dba74e5b05 refactor: add email masking function and enhance RelayInfo logging
This commit introduces a new function, MaskEmail, to mask user email addresses in logs, preventing PII leakage. Additionally, the RelayInfo logging has been updated to utilize this new masking function, ensuring sensitive information is properly handled. The channel test logic has also been improved to dynamically determine the relay format based on the request path.
2025-08-15 12:50:27 +08:00
CaIon
f6f9e73fa3 refactor: improve channel base URL handling and enhance RelayInfo logging 2025-08-14 22:15:18 +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
8907e5cf6d feat: Add ChannelOtherSettings to manage additional channel configurations 2025-08-10 20:21:30 +08:00
RedwindA
74057324b2 fix typo; add ParamOverride for Gemini Embedding 2025-08-09 01:07:48 +08:00
RedwindA
8127ad9929 feat: support native Gemini Embedding 2025-08-09 00:27:33 +08:00
feitianbubu
ea7fd9875b feat: enable thinking mode on ali thinking model 2025-08-07 11:59:54 +08:00
CaIon
1f9134cd6b feat: add support for multi-key channels in RelayInfo and access token caching 2025-08-02 22:12:15 +08:00
creamlike1024
1bb8a314cb Merge branch 'fix/gemini-native-sse' of github.com:RedwindA/new-api into RedwindA-fix/gemini-native-sse 2025-07-30 20:34:12 +08:00
Xyfacai
dfc826a388 fix(response): tools 需要处理的参数很少 使用 map 2025-07-20 11:21:57 +08:00
RedwindA
4d9b5bcf48 增加 DisablePing 字段以控制是否发送自定义 Ping 2025-07-18 23:38:35 +08:00
CaIon
8e11b67ece feat(channel): enhance channel status management 2025-07-10 17:49:53 +08:00
CaIon
1437ceaa56 Merge branch 'alpha' into refactor_error
# Conflicts:
#	controller/channel.go
#	middleware/distributor.go
#	model/channel.go
#	model/user.go
#	model/user_cache.go
#	relay/common/relay_info.go
2025-07-10 15:11:55 +08:00
Xiangyuan-liu
db98c0f4b1 refactor: log params and channel params
refactor: log params and channel params
2025-07-07 14:26:37 +08:00