Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
6fa704d6
Commit
6fa704d6
authored
Jan 05, 2026
by
song
Browse files
fix: Antigravity 账户刷新 token 500 错误
AccountHandler.Refresh 方法缺少对 Antigravity 平台的处理分支, 导致刷新时错误地走进 Claude 刷新逻辑。
parent
0400fcdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/cmd/server/wire_gen.go
View file @
6fa704d6
...
@@ -105,7 +105,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
...
@@ -105,7 +105,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
concurrencyCache
:=
repository
.
ProvideConcurrencyCache
(
redisClient
,
configConfig
)
concurrencyCache
:=
repository
.
ProvideConcurrencyCache
(
redisClient
,
configConfig
)
concurrencyService
:=
service
.
ProvideConcurrencyService
(
concurrencyCache
,
accountRepository
,
configConfig
)
concurrencyService
:=
service
.
ProvideConcurrencyService
(
concurrencyCache
,
accountRepository
,
configConfig
)
crsSyncService
:=
service
.
NewCRSSyncService
(
accountRepository
,
proxyRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
)
crsSyncService
:=
service
.
NewCRSSyncService
(
accountRepository
,
proxyRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
)
accountHandler
:=
admin
.
NewAccountHandler
(
adminService
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
rateLimitService
,
accountUsageService
,
accountTestService
,
concurrencyService
,
crsSyncService
)
accountHandler
:=
admin
.
NewAccountHandler
(
adminService
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
rateLimitService
,
accountUsageService
,
accountTestService
,
concurrencyService
,
crsSyncService
)
oAuthHandler
:=
admin
.
NewOAuthHandler
(
oAuthService
)
oAuthHandler
:=
admin
.
NewOAuthHandler
(
oAuthService
)
openAIOAuthHandler
:=
admin
.
NewOpenAIOAuthHandler
(
openAIOAuthService
,
adminService
)
openAIOAuthHandler
:=
admin
.
NewOpenAIOAuthHandler
(
openAIOAuthService
,
adminService
)
geminiOAuthHandler
:=
admin
.
NewGeminiOAuthHandler
(
geminiOAuthService
)
geminiOAuthHandler
:=
admin
.
NewGeminiOAuthHandler
(
geminiOAuthService
)
...
...
backend/internal/handler/admin/account_handler.go
View file @
6fa704d6
...
@@ -34,15 +34,16 @@ func NewOAuthHandler(oauthService *service.OAuthService) *OAuthHandler {
...
@@ -34,15 +34,16 @@ func NewOAuthHandler(oauthService *service.OAuthService) *OAuthHandler {
// AccountHandler handles admin account management
// AccountHandler handles admin account management
type
AccountHandler
struct
{
type
AccountHandler
struct
{
adminService
service
.
AdminService
adminService
service
.
AdminService
oauthService
*
service
.
OAuthService
oauthService
*
service
.
OAuthService
openaiOAuthService
*
service
.
OpenAIOAuthService
openaiOAuthService
*
service
.
OpenAIOAuthService
geminiOAuthService
*
service
.
GeminiOAuthService
geminiOAuthService
*
service
.
GeminiOAuthService
rateLimitService
*
service
.
RateLimitService
antigravityOAuthService
*
service
.
AntigravityOAuthService
accountUsageService
*
service
.
AccountUsageService
rateLimitService
*
service
.
RateLimitService
accountTestService
*
service
.
AccountTestService
accountUsageService
*
service
.
AccountUsageService
concurrencyService
*
service
.
ConcurrencyService
accountTestService
*
service
.
AccountTestService
crsSyncService
*
service
.
CRSSyncService
concurrencyService
*
service
.
ConcurrencyService
crsSyncService
*
service
.
CRSSyncService
}
}
// NewAccountHandler creates a new admin account handler
// NewAccountHandler creates a new admin account handler
...
@@ -51,6 +52,7 @@ func NewAccountHandler(
...
@@ -51,6 +52,7 @@ func NewAccountHandler(
oauthService
*
service
.
OAuthService
,
oauthService
*
service
.
OAuthService
,
openaiOAuthService
*
service
.
OpenAIOAuthService
,
openaiOAuthService
*
service
.
OpenAIOAuthService
,
geminiOAuthService
*
service
.
GeminiOAuthService
,
geminiOAuthService
*
service
.
GeminiOAuthService
,
antigravityOAuthService
*
service
.
AntigravityOAuthService
,
rateLimitService
*
service
.
RateLimitService
,
rateLimitService
*
service
.
RateLimitService
,
accountUsageService
*
service
.
AccountUsageService
,
accountUsageService
*
service
.
AccountUsageService
,
accountTestService
*
service
.
AccountTestService
,
accountTestService
*
service
.
AccountTestService
,
...
@@ -58,15 +60,16 @@ func NewAccountHandler(
...
@@ -58,15 +60,16 @@ func NewAccountHandler(
crsSyncService
*
service
.
CRSSyncService
,
crsSyncService
*
service
.
CRSSyncService
,
)
*
AccountHandler
{
)
*
AccountHandler
{
return
&
AccountHandler
{
return
&
AccountHandler
{
adminService
:
adminService
,
adminService
:
adminService
,
oauthService
:
oauthService
,
oauthService
:
oauthService
,
openaiOAuthService
:
openaiOAuthService
,
openaiOAuthService
:
openaiOAuthService
,
geminiOAuthService
:
geminiOAuthService
,
geminiOAuthService
:
geminiOAuthService
,
rateLimitService
:
rateLimitService
,
antigravityOAuthService
:
antigravityOAuthService
,
accountUsageService
:
accountUsageService
,
rateLimitService
:
rateLimitService
,
accountTestService
:
accountTestService
,
accountUsageService
:
accountUsageService
,
concurrencyService
:
concurrencyService
,
accountTestService
:
accountTestService
,
crsSyncService
:
crsSyncService
,
concurrencyService
:
concurrencyService
,
crsSyncService
:
crsSyncService
,
}
}
}
}
...
@@ -415,6 +418,19 @@ func (h *AccountHandler) Refresh(c *gin.Context) {
...
@@ -415,6 +418,19 @@ func (h *AccountHandler) Refresh(c *gin.Context) {
newCredentials
[
k
]
=
v
newCredentials
[
k
]
=
v
}
}
}
}
}
else
if
account
.
Platform
==
service
.
PlatformAntigravity
{
tokenInfo
,
err
:=
h
.
antigravityOAuthService
.
RefreshAccountToken
(
c
.
Request
.
Context
(),
account
)
if
err
!=
nil
{
response
.
ErrorFrom
(
c
,
err
)
return
}
newCredentials
=
h
.
antigravityOAuthService
.
BuildAccountCredentials
(
tokenInfo
)
for
k
,
v
:=
range
account
.
Credentials
{
if
_
,
exists
:=
newCredentials
[
k
];
!
exists
{
newCredentials
[
k
]
=
v
}
}
}
else
{
}
else
{
// Use Anthropic/Claude OAuth service to refresh token
// Use Anthropic/Claude OAuth service to refresh token
tokenInfo
,
err
:=
h
.
oauthService
.
RefreshAccountToken
(
c
.
Request
.
Context
(),
account
)
tokenInfo
,
err
:=
h
.
oauthService
.
RefreshAccountToken
(
c
.
Request
.
Context
(),
account
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment