Commit Graph

28 Commits

Author SHA1 Message Date
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
creamlike1024
8ea4c76f2b feat: support /v1/responses API 2025-05-02 13:59:46 +08:00
CaIon
984f91d111 feat: support zhipu_4v embeddings path 2025-04-10 20:53:51 +08:00
1808837298@qq.com
921ad4530e refactor: Replace direct access to ImageUrl with GetImageMedia method across multiple relay channels 2025-03-15 19:43:37 +08:00
CalciumIon
5021000c5d refactor: Simplify OpenAI handler function signature and remove unused TextResponseWithError struct; introduce common_handler for rerank functionality 2025-03-14 17:31:05 +08:00
1808837298@qq.com
47c297794d feat: 初步兼容流模式下openai渠道类型转为claude格式访问 #862 2025-03-13 19:32:08 +08:00
1808837298@qq.com
78fc3a191c feat: claude relay 2025-03-12 21:31:46 +08:00
1808837298@qq.com
d647214555 refactor: Centralize stream handling and helper functions in relay package 2025-03-05 19:47:41 +08:00
1808837298@qq.com
5ef44f6898 feat: Improve image handling for Ollama channels 2025-02-19 20:45:42 +08:00
Jerry
fcc32ffbc9 Fix M3E not working 2025-01-23 05:54:39 +08:00
1808837298@qq.com
9e4133a890 feat: realtime
(cherry picked from commit a5529df3e1a4c08a120e8c05203a7d885b0fe8d8)
2024-11-05 19:24:14 +08:00
Nanami
30b14e7d62 feat: support more zhipu models 2024-08-31 10:20:22 +08:00
CalciumIon
d06018cd3f chore: gopool 2024-07-19 01:07:37 +08:00
CalciumIon
ee0e1c9736 refactor: audio relay 2024-07-16 22:07:10 +08:00
CalciumIon
22ed887350 chore: openai stream 2024-07-15 22:07:50 +08:00
CalciumIon
7b20b4ed3d fix: azure stream options 2024-07-15 16:05:30 +08:00
CalciumIon
22bc0bf773 feat: support stream_options 2024-07-08 01:27:57 +08:00
CalciumIon
c7ba4a245b feat: support cohere rerank 2024-07-06 17:09:22 +08:00
CalciumIon
6e92f1f2d1 feat: 记录流模式首字时间 (close #323) 2024-06-26 18:04:49 +08:00
CaIon
86ab64ec67 feat: 完善函数计费 2024-04-23 23:01:06 +08:00
CaIon
54c18dc89e fix: remove sensitive check on completion (close #157) 2024-03-29 22:20:14 +08:00
CaIon
d162d95928 fix: GLM-4V 的 Vision 兼容问题 (close #136) 2024-03-23 17:08:34 +08:00
CaIon
1004e3a1d5 fix: fix embedding 2024-03-21 17:39:05 +08:00
CaIon
580f2894ac feat: 初步兼容生成内容检查 2024-03-20 19:00:51 +08:00
CaIon
14892a6582 feat: 初步兼容敏感词过滤 2024-03-20 17:07:42 +08:00
CaIon
a56cf9fa6d fix: chatglm top_p error (close #124) 2024-03-17 22:55:29 +08:00
1808837298@qq.com
d703cccc8a fix: 修复流模式错误扣费的问题 (close #95) 2024-03-06 17:41:55 +08:00
1808837298@qq.com
144579e87f feat: 修复智谱GLM-4V流模式异常 2024-03-01 22:31:08 +08:00