Merge pull request #1437 from DaydreamCoding/fix/openai-oauth-improvements
feat(openai): OpenAI OAuth 账号管理增强:订阅状态、隐私设置、Token 刷新修复
This commit is contained in:
@@ -1642,16 +1642,29 @@ func (s *adminServiceImpl) CreateAccount(ctx context.Context, input *CreateAccou
|
||||
}
|
||||
}
|
||||
|
||||
// Antigravity OAuth 账号:创建后异步设置隐私
|
||||
if account.Platform == PlatformAntigravity && account.Type == AccountTypeOAuth {
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
slog.Error("create_account_antigravity_privacy_panic", "account_id", account.ID, "recover", r)
|
||||
}
|
||||
// OAuth 账号:创建后异步设置隐私。
|
||||
// 使用 Ensure(幂等)而非 Force:新建账号 Extra 为空时效果相同,但更安全。
|
||||
if account.Type == AccountTypeOAuth {
|
||||
switch account.Platform {
|
||||
case PlatformOpenAI:
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
slog.Error("create_account_openai_privacy_panic", "account_id", account.ID, "recover", r)
|
||||
}
|
||||
}()
|
||||
s.EnsureOpenAIPrivacy(context.Background(), account)
|
||||
}()
|
||||
s.EnsureAntigravityPrivacy(context.Background(), account)
|
||||
}()
|
||||
case PlatformAntigravity:
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
slog.Error("create_account_antigravity_privacy_panic", "account_id", account.ID, "recover", r)
|
||||
}
|
||||
}()
|
||||
s.EnsureAntigravityPrivacy(context.Background(), account)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
return account, nil
|
||||
|
||||
Reference in New Issue
Block a user