mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: use codex quota refresh for account checks
This commit is contained in:
@@ -82,4 +82,16 @@ describe('oauthRefreshFeedback', () => {
|
||||
message: 'Token 刷新成功,已重新检查额度/账号状态',
|
||||
})
|
||||
})
|
||||
|
||||
it('includes the recheck failure detail after a successful token refresh', () => {
|
||||
expect(
|
||||
getOAuthRefreshFeedback({
|
||||
accountStateRecheckAttempted: true,
|
||||
accountStateRecheckError: 'wham/usage API 返回状态码 401',
|
||||
}),
|
||||
).toEqual({
|
||||
tone: 'warning',
|
||||
message: 'Token 刷新成功,但额度/账号状态复检失败:wham/usage API 返回状态码 401',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -20,6 +20,13 @@ function normalizeText(value: unknown): string | null {
|
||||
return text || null
|
||||
}
|
||||
|
||||
function formatRecheckError(value: string): string {
|
||||
const collapsed = value.replace(/\s+/g, ' ').trim()
|
||||
const maxLength = 180
|
||||
if (collapsed.length <= maxLength) return collapsed
|
||||
return `${collapsed.slice(0, maxLength - 3).trimEnd()}...`
|
||||
}
|
||||
|
||||
export function resolveOAuthAccountBlockDisplay(
|
||||
snapshot: ProviderKeyStatusCarrier,
|
||||
): OAuthAccountBlockDisplay {
|
||||
@@ -45,7 +52,7 @@ export function getOAuthRefreshFeedback(
|
||||
if (recheckError) {
|
||||
return {
|
||||
tone: 'warning',
|
||||
message: 'Token 刷新成功,但额度/账号状态复检失败',
|
||||
message: `Token 刷新成功,但额度/账号状态复检失败:${formatRecheckError(recheckError)}`,
|
||||
}
|
||||
}
|
||||
if (blockedLabel) {
|
||||
|
||||
Reference in New Issue
Block a user