Commit Graph

36 Commits

Author SHA1 Message Date
Laisky.Cai
3f905ea0a4 Merge branch 'upstream/main' 2024-09-25 09:22:57 +00:00
TimeTrapzz
a21681096a
feat: add siliconflow usage (#1798) 2024-09-22 16:31:26 +08:00
Laisky.Cai
c524e60d9f Merge remote-tracking branch 'origin/upstream/main' 2024-05-29 06:12:37 +00:00
JustSong
ceea4c6d4a feat: support user content download proxy & relay proxy now 2024-05-29 01:14:00 +08:00
Laisky.Cai
ca23dd9a97 Merge commit '1c2654320e5b6268b13b6efca40ce37a523d032b' 2024-04-28 01:53:31 +00:00
Laisky.Cai
c735b9b4d3 Merge commit '2369025842b828ac38f4427fd1ebab8d03b1fe7f' 2024-04-20 01:07:29 +00:00
Laisky.Cai
50bab08496 Refactor codebase, introduce relaymode package, update constants and improve consistency
- Refactor constant definitions and organization
- Clean up package level variables and functions
- Introduce new `relaymode` and `apitype` packages for constant definitions
- Refactor and simplify code in several packages including `openai`, `relay/channel/baidu`, `relay/util`, `relay/controller`, `relay/channeltype`
- Add helper functions in `relay/channeltype` package to convert channel type constants to corresponding API type constants
- Remove deprecated functions such as `ResponseText2Usage` from `relay/channel/openai/helper.go`
- Modify code in `relay/util/validation.go` and related files to use new `validator.ValidateTextRequest` function
- Rename `util` package to `relaymode` and update related imports in several packages
2024-04-06 05:18:04 +00:00
JustSong
0b8ccb94eb chore: reorganize common package 2024-04-06 02:03:59 +08:00
JustSong
f586ae0ad8 chore: remove helper & util subpackage for relay 2024-04-06 01:50:12 +08:00
JustSong
f9d914873f chore: reorganize constant related package 2024-04-06 00:44:33 +08:00
Laisky.Cai
d953da1ff2 fix: Upgrade error handling to errors/v2 package and refactor error messages.
- Refactor error handling using `errors/v2` package for improved error management and formatting
- Implement changes in relay/controller/text.go, controller/channel-test.go, controller/relay.go, common/message/email.go, relay/controller/audio.go, controller/channel-billing.go, relay/controller/helper.go, relay/channel/common.go, relay/channel/minimax/main.go, and common/message/main.go
- Add package imports and update package paths for better code organization
- Replace hardcoded strings with error variables for consistency and readability
- Implement secure methods for generating unique Message-ID
- Improve SMTP handling and authentication in email.go
- Update response handling and error messages for better user experience
- Add constant checks and modify functions based on imageRequest parameters in helper.go
- Use `http.NewRequest` instead of `fmt.Fprint` for improved request handling in relay/channel/common.go
- Update error handling and formatting for better consistency across all files
2024-03-12 06:43:54 +00:00
Laisky.Cai
54203e3d30 fix: Update error handling to Laisky/errors/v2 package across project
- Updated error handling across multiple files with `Laisky/errors/v2` package
- Replaced hardcoded error messages with `Laisky/errors` in relay/channel/tencent/adaptor.go
- Added a function to check if a request should be retried in relay/controller/relay.go
- Removed unused imports and variables, and updated comments in various files
- Changed Redis cache handling in model/cache.go
- Refactored error handling in relay/channel/tencent/main.go and relay/channel/baidu/main.go
- Updated import paths and error handling in model/user.go, model/redemption.go, and controller/github.go
- Added import for tiktoken-go package in relay/channel/openai/token.go
- Added GetSign and ParseConfig functions in relay/channel/tencent/main.go
- Replaced specific error imports with a more general one in relay/channel/ali/adaptor.go
- Updated import comments and function calls in relay/channel/ali/adaptor.go
- Added checks and custom error messages in model/token.go
- Removed unused functions and variables in relay/channel/baidu/adaptor.go
- Imported "github.com/Laisky/errors/v2" package in controller/channel-billing.go
- Removed unused import packages in [relay/channel/tencent/adaptor.go](http://relay/channel/tencent/adaptor.go) and relay/channel/palm/adaptor.go
- Updated go.mod and go.sum files with new dependencies and versions
2024-03-12 06:40:23 +00:00
JustSong
e54e647170 chore: remove useless code 2024-03-10 23:36:29 +08:00
JustSong
71c61365eb feat: able to only test disabled channels (#1090) 2024-03-10 18:34:57 +08:00
JustSong
12440874b0 feat: able to disable channel by success rate 2024-03-10 17:57:47 +08:00
JustSong
2cd1a78203 chore: update module name 2024-01-28 19:38:58 +08:00
JustSong
2d760d4a01
refactor: refactor relay part (#957)
* refactor: refactor relay part

* refactor: refactor config part
2024-01-21 23:21:42 +08:00
JustSong
eed9f5fdf0
refactor: refactor relay part (#935) 2024-01-14 19:21:03 +08:00
JustSong
159b9e3369 fix: fix unable to set zero value for base url & model mapping 2023-09-18 22:07:17 +08:00
JustSong
3da119efba perf: reuse http client to reduce delay 2023-07-23 15:18:58 +08:00
ckt
dccd66b852
feat: add access_until field for subscription api (#295)
* 支持从计费渠道端点返回日期

* fix: fix wrong git base

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-07-23 13:49:09 +08:00
Cross Fire
d383302e8a
feat: support balance query for CloseAI (#240)
* 增加CloseAI余额查询功能

* 去除debug代码

* fix: bug fix

* docs: update README

---------

Co-authored-by: sudongyang <sudongyang@xiaomi.com>
Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-07-03 20:43:42 +08:00
Alone88
b1b3651e84
feat: support channel type AIGC2D (#220)
* feat: add AIGC2D Channel

* chore: remove console logging & update balance rendering

---------

Co-authored-by: Alone88 <im@aloen88.cn>
Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-06-29 21:34:17 +08:00
JustSong
4463224f04 feat: support automatic channel testing & balance updates (close #11, close #59) 2023-06-22 22:01:03 +08:00
JustSong
dc94765d32 fix: do not print response to console 2023-06-18 00:22:22 +08:00
Kidultx
a43b1e2add
feat: support API2GPT platform (#173)
* support API2GPT platform

* chore: update balance renderer

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-06-17 15:20:51 +08:00
Joe
b7d71b4f0a
feat: support update AIProxy balance (#171)
* Add: support update AIProxy balance

* fix auth header

* chore: update balance renderer

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-06-17 10:08:04 +08:00
quzard
47ca449e32
feat: add support for updating balance of channel typpe OpenAI-SB (#146, close #125)
* Add support for updating channel balance in OpenAISB

* fix: handel error

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-06-11 21:04:41 +08:00
JustSong
145bb14cb2 fix: fix not using proxy when update balance 2023-06-09 18:57:27 +08:00
JustSong
1e1c6a828f fix: prompt user the feat is not implemented (#125) 2023-06-03 11:09:14 +08:00
JustSong
98f1a627f0 fix: fix balance query (close #138) 2023-06-03 10:17:52 +08:00
JustSong
333e4216d2 fix: fix balance query (close #138) 2023-06-03 10:11:59 +08:00
JustSong
f9f42997b2 chore: only check OpenAI channel & custom channel 2023-05-23 10:00:36 +08:00
JustSong
d4794fc051 feat: return user's quota with billing api (close #92) 2023-05-22 17:10:31 +08:00
JustSong
17b7646c12 fix: fix unable to update custom channel's balance 2023-05-21 20:10:06 +08:00
JustSong
171b818504 feat: support channel remain quota query (close #79) 2023-05-21 16:09:54 +08:00