Commit Graph

120 Commits

Author SHA1 Message Date
Laisky.Cai
aa30c37e3c Merge branch 'upstream/main' 2025-02-03 12:25:00 +00:00
JustSong
8f40e11c97 feat: initial official i18n support for backend 2025-02-02 15:09:31 +08:00
JustSong
ee3ed65356 feat: i18n support 2025-02-01 23:48:05 +08:00
Laisky.Cai
f47c70aaa2 Merge branch 'upstream/main' 2025-01-31 10:32:35 +00:00
JustSong
d0402f9086 feat: record request_id 2025-01-31 17:54:04 +08:00
JustSong
1fead8e7f7 chore: add debug log for distributor 2025-01-31 17:26:33 +08:00
Laisky.Cai
d5fa98f2e0 fix: translate error messages and comments to English for consistency 2025-01-27 03:34:27 +00:00
Laisky.Cai
13b1b165bd refactor: update UI text and error messages to English for better accessibility 2025-01-19 12:59:58 +00:00
Laisky.Cai
21041ec7ac Merge branch 'main' into pr/Laisky/25 2025-01-17 07:45:29 +00:00
Laisky.Cai
9730ac3bb5 feat: support gpt-4o-audio 2025-01-14 06:38:07 +00:00
Laisky.Cai
f72c715e4c feat: support image inpainting for flux-fill on replicate 2024-12-16 09:12:24 +00:00
Laisky.Cai
60ffeb8ef6 Merge branch 'upstream/main' 2024-12-09 12:24:29 +00:00
Calcium-Ion
7c8628bd95
feat: support gzip decode (#1962)
Some checks failed
CI / Unit tests (push) Has been cancelled
CI / commit_lint (push) Has been cancelled
2024-12-04 23:34:24 +08:00
Laisky.Cai
082cfbe574 Merge remote-tracking branch 'origin/upstream/main' 2024-11-20 02:09:28 +00:00
JustSong
6eb0770a89 feat: support set system prompt for channel (close #1920) 2024-11-10 14:53:34 +08:00
抒情熊
fdd7bf41c0
feat: support multipart/form-data format request (#1690)
Some checks failed
CI / Unit tests (push) Has been cancelled
CI / commit_lint (push) Has been cancelled
* "add parser multipart/form-data"

* chore: fix impl

* chore: update impl

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-09-22 17:32:47 +08:00
Laisky.Cai
4c96688e7c Merge remote-tracking branch 'origin/upstream/main' 2024-07-23 01:14:23 +00:00
Laisky.Cai
c936198ac8
feat: add Proxy channel type and relay mode (#1678)
Add the Proxy channel type and relay mode to support proxying requests to custom upstream services.
2024-07-22 22:51:19 +08:00
Laisky.Cai
af59566766 Merge remote-tracking branch 'origin/upstream/main' 2024-07-15 05:23:11 +00:00
zijiren
a3eefb7af0
fix: rate limit can be zero (#1643) 2024-07-14 18:03:23 +08:00
Laisky.Cai
115287b8cf Merge remote-tracking branch 'origin/upstream/main' 2024-06-17 03:16:36 +00:00
Zhong Liu
c1971870fa
fix: support for Spark Lite model (#1526)
* fix: Support for Spark Lite model

* fix: fix panic

* fix: fix xunfei version config

---------

Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com>
Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-06-13 00:07:26 +08:00
Laisky.Cai
c524e60d9f Merge remote-tracking branch 'origin/upstream/main' 2024-05-29 06:12:37 +00:00
Laisky.Cai
ca23dd9a97 Merge commit '1c2654320e5b6268b13b6efca40ce37a523d032b' 2024-04-28 01:53:31 +00:00
JustSong
9026ec7510 feat: support cloudflare now 2024-04-26 23:05:48 +08:00
Laisky.Cai
425059f5c6 feat: support openai images edits api 2024-04-25 03:02:20 +00:00
Laisky.Cai
84a6817314 feat: able to fetch every request's cost 2024-04-23 00:58:25 +00:00
Laisky.Cai
7047d9605e Merge commit '3d149fedf45472eff92910324974c762fc37dad6' 2024-04-21 15:05:13 +00:00
JustSong
3d149fedf4 chore: do not hardcode context key 2024-04-21 19:43:23 +08:00
JustSong
e30ebda0fe chore: move config key to package ctxkey 2024-04-21 18:55:13 +08:00
Laisky.Cai
c735b9b4d3 Merge commit '2369025842b828ac38f4427fd1ebab8d03b1fe7f' 2024-04-20 01:07:29 +00:00
Laisky.Cai
fc9a784950
feat: support aws bedrockruntime claude3 (#1328)
* feat: support aws bedrockruntime claude3

closes #622, closes #749, closes #1300

* fix: convert to aws claude model id

* fix: Update AWS adapter to handle stream completions and calculate usage metrics

Based on the file summaries provided, here are the important bullet points for the commit message:

- Add functionality to handle stream completion events from AWS in the relay/adaptor/aws/main.go file
- Marshall AWS response to OpenAI format and calculate usage metrics in the same file
- Implement a custom render function for streaming events in the same file
- Improve error handling for JSON unmarshalling and marshalling errors in the same file

* fix: Implement AWS handler with usage tracking and error handling

- Implemented streaming response handling for AWS handler
- Set response content type to text/event-stream
- Added error handling for failed marshaling/unmarshaling
- Updated return values to include `relaymodel.ErrorWithStatusCode` and `relaymodel.Usage`
- Improved error handling and response formatting for AWS adaptor

* fix: Refactor AWS Adapter for Improved Model Mapping and Error Handling

* Refactor AWS adapter to improve model management
  - Replace hardcoded model list in `adapter.go` with a function to get models from `awsModelIDMap`
  - Update `GetModelList` function to return model list directly
  - Add `GetChannelName` function to get channel name from `Adaptor` object
* Improve error handling and code organization in main.go
  - Replace switch statement with a map to map AWS model IDs to OpenAI model IDs
  - Return an error if the model is not found in the map
  - Use a single return statement instead of wrapping multiple return statements in the `awsModelID` function
  - Add a new error message for when the model is not found in the map in the `Handler` function

* fix: bug fix

* chore: change variable name & package

* chore: change variable name

* perf: update config related code

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-04-20 00:40:47 +08:00
Laisky.Cai
e93e489ea9 fix: model id 2024-04-18 03:37:25 +00:00
Laisky.Cai
4e1bfe4879 feat: support aws bedrockruntime claude3
closes #622, closes #749, closes #1300
2024-04-18 02:52:26 +00:00
Laisky.Cai
b638a2fcbd Merge commit '7bf61f916504097ac23efb765b938d8f94c342ce' 2024-04-17 05:18:58 +00:00
JustSong
7bf61f9165 fix: fix retry not working (close #1314) 2024-04-15 23:09:12 +08:00
Laisky.Cai
9cb3a06dd5 Merge commit 'af543ab8ecb6827cbbc151c2cff181cdc3286274' 2024-04-08 01:13:00 +00:00
JustSong
3af4649b52 fix: only check model when request path in whitelist 2024-04-06 20:42:35 +08: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
f9d914873f chore: reorganize constant related package 2024-04-06 00:44:33 +08:00
JustSong
348adc2b02 feat: able to set multiple subnets 2024-04-05 17:25:28 +08:00
JustSong
840ef80d94 fix: do not try to parse model when requesting /v1/models (close #1272) 2024-04-05 12:50:31 +08:00
JustSong
c49778c254 feat: now able to limit ip range for token now (close #1275) 2024-04-05 10:09:16 +08:00
JustSong
8b9813d63b feat: /v1/models now only return available models 2024-04-04 02:44:59 +08:00
JustSong
dc7aaf2de5 feat: able to set model limitation for token (close #178) 2024-04-04 02:08:18 +08:00
Laisky.Cai
ddd2dd1041 fix: Refactor relay/channel, upgrade deps, improve request handling and error messages.
* Updated relay/channel/gemini package to use gin-gonic/gin for routing
* Added timeouts, environment variable for proxy, and error handling for HTTP clients in relay/util/init.go
* Improved error handling, URL path cases, and channel selection logic in middleware/distributor.go
* Added Content-Type header, closed request bodies, and added context to requests in relay/channel/common.go
* Upgraded various dependencies in go.mod
* Modified the GetRequestURL method in relay/channel/gemini/adaptor.go to include a "key" parameter in the URL and set a default version of "v1beta"
* Added io and net/http packages in relay/channel/gemini/adaptor.go and relay/channel/gemini/main.go
* Added a struct for GeminiStreamResp and modified response handling in relay/channel/gemini/main.go
* Imported packages for io and net/http added, gin-gonic/gin package added, and error handling improved in relay/channel/gemini/main.go
2024-03-19 03:11:19 +00:00
Laisky.Cai
41afad713e Merge remote-tracking branch 'origin/upstream/main' 2024-03-15 09:49:49 +00:00
JustSong
2dcef85285 feat: support ollama now (close #870) 2024-03-14 01:02:47 +08:00
Laisky.Cai
72501cb746 Merge remote-tracking branch 'origin/upstream/main' 2024-03-11 09:32:11 +00:00