241 Commits

Author SHA1 Message Date
Calcium-Ion
bb18f64d1f Merge pull request #1067 from QuantumNous/coze
Coze 渠道
2025-05-16 16:11:02 +08:00
CaIon
f88b7cd7f2 fix: update model selection logic for image edits in distributor middleware 2025-05-14 17:01:50 +08:00
creamlike1024
5e8217db0f use channel bot id 2025-05-13 22:23:38 +08:00
creamlike1024
c483c7df5f Merge branch 'tbphp_model_request_rate_limit_for_group' of github.com:tbphp/new-api into tbphp-tbphp_model_request_rate_limit_for_group 2025-05-08 23:16:06 +08:00
CaIon
54f69c7d80 feat: add AzureNoRemoveDotTime constant and update channel handling #1044
- Introduced a new constant `AzureNoRemoveDotTime` in `constant/azure.go` to manage model name formatting for channels created after May 10, 2025.
- Updated `distributor.go` to set `channel_create_time` in the context.
- Modified `adaptor.go` to conditionally remove dots from model names based on the channel creation time.
- Enhanced `relay_info.go` to include `ChannelCreateTime` in the `RelayInfo` struct.
- Updated English localization files to reflect changes in model name handling for new channels.
2025-05-08 22:39:55 +08:00
tbphp
b648b3cf98 fix: 缩进修复还原 2025-05-05 23:53:05 +08:00
tbphp
cd40bdbdc6 refactor: 调整代码,符合项目现有规范 2025-05-05 19:32:22 +08:00
tbphp
2a0e1ab914 fix: Redis limit ignoring max eq 0 2025-05-05 12:55:48 +08:00
tbphp
c9ce1210be feat: 优化代码,去除多余注释和修改 2025-05-05 11:34:57 +08:00
tbphp
b32ed55624 feat: 增加分组速率功能 2025-05-05 07:31:54 +08:00
CaIon
1ab9892090 Merge remote-tracking branch 'new-api/main' into gpt-image
# Conflicts:
#	relay/relay-image.go
2025-04-26 15:54:08 +08:00
xyfacai
873ebcf0c7 feat: support /images/edit
(cherry picked from commit 1c0a1238787d490f02dd9269b616580a16604180)
2025-04-26 15:44:56 +08:00
霍雨佳
e121e77265 Refactor: Optimize the token bucket algorithm, specifically the New method in common/imiterlimiter.go.
Solution: Remove Redis ping. When printing exceptions, use SysLog to print and add additional logging information.
2025-04-16 16:36:07 +08:00
霍雨佳
5aa2076e18 Refactor: Optimize the request rate limiting for ModelRequestRateLimitCount.
Reason: The original steps 1 and 3 in the redisRateLimitHandler method were not atomic, leading to poor precision under high concurrent requests. For example, with a rate limit set to 60, sending 200 concurrent requests would result in none being blocked, whereas theoretically around 140 should be intercepted.
Solution: I chose not to merge steps 1 and 3 into a single Lua script because a single atomic operation involving read, write, and delete operations could suffer from performance issues under high concurrency. Instead, I implemented a token bucket algorithm to optimize this, reducing the atomic operation to just read and write steps while significantly decreasing the memory footprint.
2025-04-16 10:33:43 +08:00
JoeyLearnsToCode
f00ac5f27b feat: Add Parameters Override 2025-03-29 14:39:39 +08:00
1808837298@qq.com
78fc3a191c feat: claude relay 2025-03-12 21:31:46 +08:00
1808837298@qq.com
fa20af817f refactor: Improve model request rate limit middleware execution 2025-03-06 16:32:11 +08:00
1808837298@qq.com
3f1e340391 refactor: Update rate limit configuration to use dynamic expiration duration 2025-03-02 17:34:39 +08:00
1808837298@qq.com
d04d78a116 refactor: Enhance user context and quota management
- Add new context keys for user-related information
- Modify user cache and authentication middleware to populate context
- Refactor quota and notification services to use context-based user data
- Remove redundant database queries by leveraging context information
- Update various components to use new context-based user retrieval methods
2025-02-25 20:56:16 +08:00
1808837298@qq.com
1763145fea feat: Add model request rate limiting functionality 2025-02-24 16:20:55 +08:00
1808837298@qq.com
cc61f85bdd fix: Remove redundant error handling in distributor and relay modules 2025-02-19 18:47:28 +08:00
Jerry
8e2059b898 Support for MokaAI M3E 2025-01-22 04:21:08 +08:00
1808837298@qq.com
530e846ac1 refactor: access_token auth 2025-01-05 22:08:23 +08:00
CalciumIon
966cdc1f7f refactor: user cache logic 2024-12-29 16:50:26 +08:00
CalciumIon
0d1ba65592 refactor: migrate group ratio and user usable groups logic to new setting package
- Replaced references to common.GroupRatio and common.UserUsableGroups with corresponding functions from the new setting package across multiple controllers and services.
- Introduced new setting functions for managing group ratios and user usable groups, enhancing code organization and maintainability.
- Updated related functions to ensure consistent behavior with the new setting package integration.
2024-12-25 19:31:12 +08:00
CalciumIon
72be58523c feat: Add request start time context key and update middleware
- Introduced a new constant `ContextKeyRequestStartTime` to store the request start time in the context, enhancing request tracking.
- Updated the `Distribute` middleware to set the request start time in the context using the new constant.
- Modified the `GenRelayInfo` function to retrieve the request start time from the context, ensuring accurate timing information is used in relay operations.
2024-12-23 20:48:10 +08:00
CalciumIon
0ad03de153 feat: implement channel settings configuration
fix #620
2024-12-15 15:52:41 +08:00
CalciumIon
270857e370 feat: support br 2024-12-04 23:53:02 +08:00
CalciumIon
407d03a0ba feat: support gzip 2024-12-04 23:24:46 +08:00
CalciumIon
c0c9b1f670 fix: realtime 2024-11-30 23:32:42 +08:00
licoy
af1f0a406d feat: 增加GLOBAL_API_RATE_LIMIT_ENABLEGLOBAL_WEB_RATE_LIMIT_ENABLE环境变量,支持是否开启访问速率控制 2024-11-12 20:02:33 +08:00
1808837298@qq.com
9e4133a890 feat: realtime
(cherry picked from commit a5529df3e1a4c08a120e8c05203a7d885b0fe8d8)
2024-11-05 19:24:14 +08:00
1808837298@qq.com
698b6ed7d7 Update dto
(cherry picked from commit 030187ff75c64c40017cda2fa98ef2b3c01f0bd5)
2024-11-05 19:23:56 +08:00
1808837298@qq.com
347cbf63bb fix: 修复用户可选分组不能选择用户分组 (close #528) 2024-10-14 16:22:22 +08:00
1808837298@qq.com
411bbac036 feat: Playground相关接口禁用AccessToken 2024-09-26 01:49:35 +08:00
1808837298@qq.com
07fa9205cb feat: playground 2024-09-26 00:59:09 +08:00
1808837298@qq.com
a50d2e6836 fix: error user role 2024-09-24 17:49:57 +08:00
CalciumIon
e5ee955f70 fix: token group #477 2024-09-18 18:55:11 +08:00
CalciumIon
4a02eb1b7f feat: 令牌分组 2024-09-18 05:19:49 +08:00
CalciumIon
6d2948d684 feat: 添加令牌ip白名单功能 2024-09-17 20:49:51 +08:00
CalciumIon
b8664e71e6 feat: support vertex ai #377 2024-08-27 20:19:51 +08:00
CalciumIon
165f29ade5 fix bug 2024-08-07 02:50:22 +08:00
CalciumIon
cba830e544 feat: log user id 2024-08-04 14:35:16 +08:00
CalciumIon
a1284e4a58 chore: 优化自动禁用代码 2024-08-03 17:32:28 +08:00
CalciumIon
658eba659b chore: 优化relay代码 2024-08-03 16:55:29 +08:00
CalciumIon
ff3c1a0d34 feat: print user id when error 2024-07-27 17:55:36 +08:00
CalciumIon
3f2df317e4 feat: print user id when error 2024-07-27 17:47:30 +08:00
CalciumIon
28397c5d82 fix: 修复nginx缓存导致串用户问题 2024-07-19 13:39:05 +08:00
Calcium-Ion
363ae95196 Merge pull request #367 from Calcium-Ion/audio
feat: support cloudflare tts
2024-07-17 17:34:59 +08:00
CalciumIon
3ada91855f fix: distribute panic 2024-07-17 17:01:25 +08:00