diff --git a/backend/internal/service/openai_gateway_service.go b/backend/internal/service/openai_gateway_service.go index 2bb0bee8..912c25af 100644 --- a/backend/internal/service/openai_gateway_service.go +++ b/backend/internal/service/openai_gateway_service.go @@ -240,7 +240,7 @@ func (s *OpenAIGatewayService) GetAccessToken(ctx context.Context, account *Acco func (s *OpenAIGatewayService) shouldFailoverUpstreamError(statusCode int) bool { switch statusCode { - case 401, 403, 429, 529: + case 401, 402, 403, 429, 529: return true default: return statusCode >= 500 @@ -454,6 +454,10 @@ func (s *OpenAIGatewayService) handleErrorResponse(ctx context.Context, resp *ht statusCode = http.StatusBadGateway errType = "upstream_error" errMsg = "Upstream authentication failed, please contact administrator" + case 402: + statusCode = http.StatusBadGateway + errType = "upstream_error" + errMsg = "Upstream payment required: insufficient balance or billing issue" case 403: statusCode = http.StatusBadGateway errType = "upstream_error" diff --git a/backend/internal/service/ratelimit_service.go b/backend/internal/service/ratelimit_service.go index 27b6d3c8..1474ae46 100644 --- a/backend/internal/service/ratelimit_service.go +++ b/backend/internal/service/ratelimit_service.go @@ -39,6 +39,10 @@ func (s *RateLimitService) HandleUpstreamError(ctx context.Context, account *Acc // 认证失败:停止调度,记录错误 s.handleAuthError(ctx, account, "Authentication failed (401): invalid or expired credentials") return true + case 402: + // 支付要求:余额不足或计费问题,停止调度 + s.handleAuthError(ctx, account, "Payment required (402): insufficient balance or billing issue") + return true case 403: // 禁止访问:停止调度,记录错误 s.handleAuthError(ctx, account, "Access forbidden (403): account may be suspended or lack permissions") diff --git a/frontend/src/components/common/Modal.vue b/frontend/src/components/common/Modal.vue new file mode 100755 index 00000000..89304de1 --- /dev/null +++ b/frontend/src/components/common/Modal.vue @@ -0,0 +1,120 @@ + + +