mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: repair CI build & lint regressions on main
- openai_gateway_model_availability.go: pass platform through to listSchedulableAccounts so OpenAI/Grok diagnosis scopes to the correct candidate pool (build break introduced by Grok subscription PR #3310). - no_account_error.go: drop redundant context.Context type on ctx := context.Background() to satisfy staticcheck ST1023.
This commit is contained in:
@@ -101,7 +101,7 @@ func classifyNoAccountErrorFromGin(
|
||||
displayModel string,
|
||||
platform string,
|
||||
) noAccountErrorClassification {
|
||||
var ctx context.Context = context.Background()
|
||||
ctx := context.Background()
|
||||
if c != nil && c.Request != nil {
|
||||
ctx = c.Request.Context()
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ import (
|
||||
)
|
||||
|
||||
// DiagnoseModelAvailabilityForPlatform reports whether the requested model
|
||||
// is configured to be served by any OpenAI account in the group. The
|
||||
// platform argument is accepted to satisfy ModelAvailabilityDiagnoser but
|
||||
// is ignored — OpenAIGatewayService only scans OpenAI accounts.
|
||||
// is configured to be served by any OpenAI-compatible account in the group
|
||||
// for the given platform (e.g. PlatformOpenAI, PlatformGrok). The platform
|
||||
// scopes the candidate pool so distinct OpenAI-compatible platforms do not
|
||||
// cross-contaminate diagnosis results.
|
||||
//
|
||||
// Safe to call on the error path: returns {true,true} on any internal
|
||||
// failure or when the inputs preclude meaningful diagnosis (empty model,
|
||||
@@ -17,7 +18,7 @@ func (s *OpenAIGatewayService) DiagnoseModelAvailabilityForPlatform(
|
||||
ctx context.Context,
|
||||
groupID *int64,
|
||||
requestedModel string,
|
||||
_ string,
|
||||
platform string,
|
||||
) ModelAvailabilityDiagnosis {
|
||||
if s == nil {
|
||||
return ModelAvailabilityDiagnosis{HasAccountsInPool: true, HasModelSupport: true}
|
||||
@@ -27,7 +28,7 @@ func (s *OpenAIGatewayService) DiagnoseModelAvailabilityForPlatform(
|
||||
return ModelAvailabilityDiagnosis{HasAccountsInPool: true, HasModelSupport: true}
|
||||
}
|
||||
|
||||
accounts, err := s.listSchedulableAccounts(ctx, groupID)
|
||||
accounts, err := s.listSchedulableAccounts(ctx, groupID, platform)
|
||||
if err != nil {
|
||||
// Conservative fallback so the caller keeps returning 503; we do not
|
||||
// want a transient lookup failure to flip into 404 model_not_found.
|
||||
|
||||
Reference in New Issue
Block a user