Commit Graph

433 Commits

Author SHA1 Message Date
Laisky.Cai
d5fa98f2e0 fix: translate error messages and comments to English for consistency 2025-01-27 03:34:27 +00:00
Laisky.Cai
59dba5bef3 fix: update error messages to English for consistency 2025-01-27 01:25:09 +00:00
Laisky.Cai
531f832d1e refactor: update variable names and improve code readability; add Makefile for linting and installation 2025-01-23 03:32:41 +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
a9604fd59c Merge branch 'upstream/main' 2024-12-22 12:13:47 +00:00
Ke Wang
95e8c16338
feat: add balance query support for DeepSeek (#1946)
* Support Balance Query for DeepSeek

* Fix
2024-12-22 19:26:33 +08:00
Ke Wang
cb9d0a74c9
fix: fix balance query for siliconflow (#1960) 2024-12-22 18:48:47 +08:00
Laisky.Cai
dc181dd7fa Merge branch 'upstream/main' 2024-12-22 02:50:40 +00:00
Laisky.Cai
e9f117ff72
feat: add gemini-2.0-flash-exp and fix race condition in processChannelRelayError (#1983)
Some checks are pending
CI / Unit tests (push) Waiting to run
CI / commit_lint (push) Waiting to run
Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com>
2024-12-21 20:32:30 +08:00
JustSong
45b51ea0ee feat: update feishu oauth login 2024-12-20 23:27:00 +08:00
Laisky.Cai
09bfd61f2e refactor: replace Laisky/errors with pkg/errors for improved error handling 2024-12-20 03:06:09 +00:00
Laisky.Cai
33493aa8b3 fix: resolve race condition in processChannelRelayError and update API version handling for gemini-2.0-flash-exp 2024-12-15 02:06:35 +00:00
Laisky.Cai
f322f8029d fix: enhance token status handling in UpdateToken function with additional cases 2024-11-20 03:02:21 +00:00
Laisky.Cai
0d9c79be35 fix: update Go base image version and enhance token status checks in UpdateToken function 2024-11-20 02:52:09 +00:00
Laisky.Cai
0e335db90c feat: add remaining quota and status fields to token update 2024-11-20 02:43:41 +00:00
Laisky.Cai
2e5e6faad7 Merge remote-tracking branch 'origin/upstream/main' 2024-10-29 01:15:54 +00:00
liangjs
3716e1b0e6
fix: use modelMap when testing a channel (#1855)
Co-authored-by: oliang <oliang@tencent.com>
2024-10-27 17:06:41 +08:00
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
OnEvent
99c8c77504
feat: add oidc support (#1725)
Some checks are pending
CI / Unit tests (push) Waiting to run
CI / commit_lint (push) Waiting to run
* feat: add the ui for configuring the third-party standard OAuth2.0/OIDC.

- update SystemSetting.js
- add setup ui
- add configuration

* feat: add the ui for "allow the OAuth 2.0 to login"

- update SystemSetting.js

* feat: add OAuth 2.0 web ui and its process functions

- update common.js
- update AuthLogin.js
- update config.js

* fix: missing "Userinfo" endpoint configuration entry, used by OAuth clients to request user information from the IdP.

- update config.js
- update SystemSetting.js

* feat: updated the icons for Lark and OIDC to match the style of the icons for WeChat, EMail, GitHub.

- update lark.svg
- new oidc.svg

* refactor: Changing OAuth 2.0 to OIDC

* feat: add OIDC login method

* feat: Add support for OIDC login to the backend

* fix: Change the AppId and AppSecret on the Web UI to the standard usage: ClientId, ClientSecret.

* feat: Support quick configuration of OIDC through Well-Known Discovery Endpoint

* feat: Standardize terminology, add well-known configuration

- Change the AppId and AppSecret on the Server End to the standard usage: ClientId, ClientSecret.
- add Well-Known configuration to store in database, no actual use in server end but store and display in web ui only
2024-09-21 23:03:20 +08:00
qinguoyi
3a27c90910
fix: getTokenById return token nil, make panic (#1728)
* fix:getTokenById return token nil, make panic

* chore: remove useless err check

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-09-21 23:00:29 +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
f9417d32e1 Merge remote-tracking branch 'origin/upstream/main' 2024-07-09 06:28:06 +00:00
Qiying Wang
d7a78f3397
feat: support test specific model (#1600) 2024-07-05 18:05:16 +08:00
Laisky.Cai
c20f27ec45 Merge remote-tracking branch 'origin/upstream/main' 2024-07-01 03:09:33 +00:00
igophper
34cb147a74
refactor: replace hardcoded string with ctxkey constant (#1579)
Co-authored-by: 江杭辉 <jianghanghui@k.app>
2024-06-30 16:13:43 +08:00
Laisky.Cai
4fd0b247d2 chore: decrease token quota in ConsumeToken function
This commit modifies the ConsumeToken function in the token.go file to decrease the token quota by the specified amount. It replaces the previous code that directly updated the quota values with a call to the DecreaseTokenQuota function from the model package. This change improves code clarity and maintainability.

Closes #123
2024-06-25 06:15:07 +00:00
Laisky.Cai
671039f050 fix: Update AddUsedQuota data type in consumeTokenRequest struct 2024-06-25 06:08:33 +00:00
Laisky.Cai
078be37e87 chore: Update consumeTokenRequest struct in token.go for better clarity 2024-06-24 08:20:49 +00:00
Laisky.Cai
4eade81869 chore: add endpoint for consuming tokens
This commit adds a new endpoint `/token/consume` to the API router, allowing users to consume tokens from another source. It includes changes to the `token.go` file in the `controller` package.
2024-06-24 07:58:14 +00:00
Laisky.Cai
a8cc96bf4a chore: update token.go to record consumption log 2024-06-24 06:14:58 +00:00
Laisky.Cai
1d82e509aa chore: refactor updateTokenDto struct in token.go for better clarity 2024-06-24 06:06:57 +00:00
Laisky.Cai
0e35db82d5 chore: Update token.go to allow admin to add or subtract used quota 2024-06-24 05:52:23 +00:00
Laisky.Cai
115287b8cf Merge remote-tracking branch 'origin/upstream/main' 2024-06-17 03:16:36 +00:00
jinjianming
f74577141c
fix: fix default token not created in some cases (#1510)
* 修复git、微信等用户注册不会创建默认令牌问题

修复git、微信等用户注册不会创建默认令牌问题

* 修复git、微信等用户注册不会创建默认令牌问题

删除普通用户注册代码

* fix: do not block if error happened

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-06-13 00:20:48 +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
carey036
b53e00a9b3
feat: generate default token after register (#1401)
* feat: generate default token after register

* chore: use go routine to create default token for new user

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-05-28 01:44:38 +08:00
Ghostz
fa74ba0eaa
chore: print user id when relay error happened (#1447)
* add userid when relay error

* chore: update log format

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-05-28 01:30:51 +08:00
Laisky.Cai
ca23dd9a97 Merge commit '1c2654320e5b6268b13b6efca40ce37a523d032b' 2024-04-28 01:53:31 +00:00
tylinux
1bd14af47b
feat: use mapped model name to test (#1370) 2024-04-27 15:53:20 +08: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
8de489cf06 feat: support coze now 2024-04-21 17:59:57 +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