CaIon
98952198bb
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
eb265a55e1
✨ feat: enhance environment configuration and resource initialization
2025-07-01 13:13:30 +08:00
CaIon
281054ff4c
🐛 fix: replace direct response body closure with common.CloseResponseBodyGracefully for improved error handling
...
This update standardizes the closure of HTTP response bodies across multiple stream handlers, enhancing error management and resource cleanup. The new method ensures that any errors during closure are handled gracefully, preventing potential request termination issues.
2025-06-27 21:40:36 +08:00
CaIon
3002659f47
✨ feat: add CloseResponseBodyGracefully function to handle HTTP response body closure
2025-06-27 21:37:13 +08:00
Xyfacai
b778cd2b23
refactor: message content 改成 any
...
refactor: message content 改成 any
2025-06-07 23:47:22 +08:00
creamlike1024
425feb88d8
feat: support /v1/responses API
2025-05-02 13:59:46 +08:00
1808837298@qq.com
7e46d4217d
feat: 初步兼容流模式下openai渠道类型转为claude格式访问 #862
2025-03-13 19:32:08 +08:00
1808837298@qq.com
bd48f43410
feat: claude relay
2025-03-12 21:31:46 +08:00
1808837298@qq.com
37a83ecc33
refactor: Centralize stream handling and helper functions in relay package
2025-03-05 19:47:41 +08:00
1808837298@qq.com
f5e3063f33
feat: Improve embedding request handling and support across channels
...
- Update EmbeddingRequest DTO to support more flexible input types
- Add input parsing method to handle various input formats
- Implement ConvertEmbeddingRequest for multiple channel adaptors
- Remove relayMode parameter from EmbeddingHelper
- Add input validation for embedding requests
- Simplify embedding request conversion for different channels
2025-02-12 14:39:36 +08:00
kuwork
89d48a6618
Merge branch 'main' into main
2025-02-04 22:52:37 +08:00
Jerry
7588c42b42
Fix M3E not working
2025-01-23 05:54:39 +08:00
Butui Hu
eda7ef50e0
Fix temperature not being set to 0 due to json omitempty
...
The issue was caused by the `omitempty` tag in the Go struct, which prevented the `temperature` field from being included in the JSON output when it was set to 0.
Signed-off-by: Butui Hu <hot123tea123@gmail.com >
2025-01-21 12:54:09 +08:00
CalciumIon
195ab1fdd5
feat: add gemini tool_calls finish reason
2024-12-06 14:31:27 +08:00
1808837298@qq.com
33af069fae
feat: realtime
...
(cherry picked from commit a5529df3e1a4c08a120e8c05203a7d885b0fe8d8)
2024-11-05 19:24:14 +08:00
CalciumIon
bcc7f3edb2
refactor: audio relay
2024-07-16 22:07:10 +08:00
CalciumIon
0f687aab9a
fix: azure stream options
2024-07-15 16:05:30 +08:00
CalciumIon
90abe7f27d
fix: baidu max_output_tokens ( #353 )
2024-07-08 19:50:12 +08:00
CalciumIon
02545e4856
fix: baidu max_output_tokens ( close #353 )
2024-07-08 19:46:45 +08:00
CalciumIon
8af4e28f75
feat: support cohere rerank
2024-07-06 17:09:22 +08:00
CalciumIon
eb382d28ab
feat: update baidu
2024-07-05 20:22:30 +08:00
Akarin
d33b802dac
Squashed commit of the following:
...
commit 5a6a0df45dee3dfbf2f65591a79fe5f2b74a49e6
Author: Akarin <jimmyshjj@gmail.com >
Date: Thu May 16 14:05:28 2024 +0800
Revert "Update docker-image-amd64.yml"
This reverts commit 581343a78783bbd779e65b476e125af0e2b64ce5.
commit a0aec1bd030da2c6b25d9541199d598f16813a60
Merge: 5b46c7d 58abb38
Author: Jiayun Shen <jimmyshjj@gmail.com >
Date: Thu May 16 06:46:51 2024 +0800
Merge branch 'main' of https://github.com/jimmyshjj/new-api
commit 58abb3864a89294d82f812cda9fe49ccf7e2dd91
Merge: 7d2c026 93858c3
Author: Akarin <jimmyshjj@gmail.com >
Date: Thu May 16 06:46:00 2024 +0800
Merge branch 'Calcium-Ion:main' into main
commit 5b46c7dd8e6132d2be3b59c7b2ed6a4b84b93cef
Author: Jiayun Shen <jimmyshjj@gmail.com >
Date: Thu May 16 06:45:00 2024 +0800
Update constants.go
Remove replaced Baidu models
commit 7d2c02679cd90b8b53f4145f83969b980a8c2095
Author: Akarin <jimmyshjj@gmail.com >
Date: Wed May 15 23:40:50 2024 +0800
Update adaptor.go - Normalize model name to lowercase
Baidu's official model names may include mixed case letters, but their model APIs are case-sensitive and accept only lowercase. To ensure compatibility, the default behavior has been updated to convert model names to lowercase before constructing API requests.
commit 6bc168a39d9a6194d66f2f32b175e56de9295b2e
Merge: bb9fecd 910e76a
Author: Jiayun Shen <jimmyshjj@gmail.com >
Date: Wed May 15 21:51:52 2024 +0800
Merge branch 'main' of https://github.com/jimmyshjj/new-api
commit 910e76ac94d7f5dca6254abb4d0669cbb762e724
Merge: 581343a ff044de
Author: Akarin <jimmyshjj@gmail.com >
Date: Wed May 15 21:51:13 2024 +0800
Merge branch 'Calcium-Ion:main' into main
commit bb9fecd5bf2bd9f1859a4017e7e68f80bdb6685a
Author: Jiayun Shen <jimmyshjj@gmail.com >
Date: Wed May 15 21:50:08 2024 +0800
update Baidu and 360 models
Add Baidu and 360 new models. Add Baidu completion ratio
commit 581343a78783bbd779e65b476e125af0e2b64ce5
Author: Akarin <jimmyshjj@gmail.com >
Date: Wed May 15 19:41:34 2024 +0800
Update docker-image-amd64.yml
commit de17e2d95eec80f1eeae66e82dec4e9601cdee43
Merge: 046f653 a3b3e6c
Author: Akarin <jimmyshjj@gmail.com >
Date: Wed May 15 19:22:09 2024 +0800
Merge branch 'Calcium-Ion:main' into main
commit 046f6537913ae8ad8ecf21019b64c0379331b3fd
Merge: 4164d51 7b58305
Author: Akarin <jimmyshjj@gmail.com >
Date: Wed May 15 15:32:38 2024 +0800
Merge branch 'Calcium-Ion:main' into main
commit 4164d51207808283a18ca2728241fd5cddc4855f
Merge: ef35b07 c222bc8
Author: Akarin <jimmyshjj@gmail.com >
Date: Wed May 15 11:19:13 2024 +0800
Merge branch 'Calcium-Ion:main' into main
commit ef35b072824b5095ecd2d1ed7ca9fa11673da2c4
Author: Jiayun Shen <jimmyshjj@gmail.com >
Date: Tue May 14 19:17:32 2024 +0800
Update adaptor.go
Update frequently used model names from Baidu official docs and support custom models
2024-05-16 14:05:44 +08:00
CaIon
d1c8947851
fix: 规范claude返回格式
2024-04-25 23:57:39 +08:00
CaIon
44a8ade4ba
fix: remove sensitive check on completion ( close #157 )
2024-03-29 22:20:14 +08:00
CaIon
64b9d3b58c
feat: 初步兼容生成内容检查
2024-03-20 19:00:51 +08:00
1808837298@qq.com
626217fbd4
fix: 修复流模式错误扣费的问题 ( close #95 )
2024-03-06 17:41:55 +08:00
1808837298@qq.com
3ab4f145db
feat: 支持部分渠道的system角色 ( close #89 )
2024-03-06 14:16:04 +08:00
1808837298@qq.com
6013219f5b
feat: 初步重构完成
2024-02-29 16:21:25 +08:00
1808837298@qq.com
5b18cd6b0a
feat: 初步重构
2024-02-29 01:08:18 +08:00