-
Notifications
You must be signed in to change notification settings - Fork 11.3k
feat: Create a user API to synchronously return the user ID and simul… #2251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
82ca930
feat: Create a user API to synchronously return the user ID and simul…
bddiudiu 47020e4
feat: Add group parameters when creating a user
bddiudiu 542447a
chore(deps): bump golang.org/x/crypto from 0.42.0 to 0.45.0
dependabot[bot] f95cf0c
fix: claude cache price render
seefs001 ba1a158
feat: Fill thoughtSignature only for Gemini/Vertex channels using the…
seefs001 7cb6fc7
fix: When retrieving the model list with multiple keys, select the fi…
seefs001 f88e14b
feat: Add ContextKeyLocalCountTokens and update ResponseText2Usage to…
Calcium-Ion c1b8983
fix: 错误解析responses api中的input字段
jarvis-u 2799c94
add Vietnamese language support
chokiproai 2e42b73
fix: Update GET_MEDIA_TOKEN_NOT_STREAM default value to false
Calcium-Ion 63c1af6
feat: Add CountToken configuration and update token counting logic
Calcium-Ion 92c5b44
feat: 关联 discord 账号
StageDog 305e069
feat: 针对 discord 登录配置使用新版设置方案
StageDog 50ca4e3
fix: IsDiscordIdAlreadyTaken 应该检查软删除记录
StageDog 817082d
refactor: Deprecate HARM_CATEGORY_CIVIC_INTEGRITY in safety settings
Calcium-Ion 83c4924
feat: Set ContextKeyLocalCountTokens in NativeGeminiEmbeddingHandler …
Calcium-Ion ee96ca6
feat: gemini thinking_level && snake params
seefs001 4f94c3b
feat: embedding param override && internal params
seefs001 75902d2
feat: 二次确认添加重定向前模型
seefs001 e84a873
feat: 重定向后的模型视为已有的模型,附带特殊提示
seefs001 8837132
fix: release workflow show version
seefs001 d5259cf
Revert "fix: release workflow show version"
bddiudiu 5864959
Revert "feat: 重定向后的模型视为已有的模型,附带特殊提示"
bddiudiu 3bc3fe5
Revert "feat: 二次确认添加重定向前模型"
bddiudiu 80a0f52
Revert "feat: embedding param override && internal params"
bddiudiu 6bf3feb
Revert "feat: gemini thinking_level && snake params"
bddiudiu 4e72998
Revert "feat: Set ContextKeyLocalCountTokens in NativeGeminiEmbedding…
bddiudiu a857f95
Revert "refactor: Deprecate HARM_CATEGORY_CIVIC_INTEGRITY in safety s…
bddiudiu 35936e1
Revert "fix: IsDiscordIdAlreadyTaken 应该检查软删除记录"
bddiudiu 1ae0070
Revert "feat: 针对 discord 登录配置使用新版设置方案"
bddiudiu 38483b6
Revert "feat: 关联 discord 账号"
bddiudiu f501b90
Revert "feat: Add CountToken configuration and update token counting …
bddiudiu 0f52a1a
Revert "fix: Update GET_MEDIA_TOKEN_NOT_STREAM default value to false"
bddiudiu 15c9af6
Revert "add Vietnamese language support"
bddiudiu 3e1f4ef
Revert "fix: 错误解析responses api中的input字段"
bddiudiu 34d68c8
Revert "feat: Add ContextKeyLocalCountTokens and update ResponseText2…
bddiudiu 5e7e68e
Revert "fix: When retrieving the model list with multiple keys, selec…
bddiudiu 5e786f2
Revert "feat: Fill thoughtSignature only for Gemini/Vertex channels u…
bddiudiu cbe5463
Revert "fix: claude cache price render"
bddiudiu f8e4278
Revert "chore(deps): bump golang.org/x/crypto from 0.42.0 to 0.45.0"
bddiudiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical inconsistency and multiple concerns with token generation logic.
Several issues identified:
Inconsistency in ID retrieval: This code uses
cleanUser.Iddirectly afterInsert()(line 884), but theRegisterfunction (lines 226-233) queries the database to retrieve the inserted user's ID. This inconsistency suggests uncertainty about whether GORM populates the ID field after insertion.Contradictory quota settings: Setting both
RemainQuota: 500000andUnlimitedQuota: trueis contradictory. If the quota is unlimited, why set a remain quota?Hard-coded values: The quota value (500000) and Chinese text ("的初始令牌") are hard-coded, reducing configurability and creating i18n issues.
Code duplication: This token generation logic is nearly identical to lines 235-267 in the
Registerfunction, violating DRY principles.Partial failure without rollback: If token creation fails after user creation, the user exists without a token. Without a transaction wrapping both operations, this creates an inconsistent state.
Recommended actions:
cleanUser.Idis populated afterInsert(). If not, fetch it from the database as done inRegister.RemainQuotasetting whenUnlimitedQuotais true, or make quota configuration explicit.Then wrap both operations in a transaction: