Fix composite Grok video status routing

This commit is contained in:
Heatherm Huang
2026-07-23 09:20:52 +08:00
parent ee332cee64
commit 06e7d12640
2 changed files with 20 additions and 1 deletions
+4 -1
View File
@@ -106,7 +106,10 @@ func RegisterGatewayRoutes(
})
}
videoStatusHandler := func(c *gin.Context) {
if getGroupPlatform(c) == service.PlatformGrok {
// Video status requests do not carry a model, so composite groups cannot
// be resolved by compositeTargetPlatformMiddleware. Route them through
// the Grok handler and let scheduler/account selection enforce capacity.
if getGroupPlatform(c) == service.PlatformGrok || getGroupPlatform(c) == service.PlatformComposite {
h.OpenAIGateway.GrokVideoStatus(c)
return
}
@@ -177,6 +177,22 @@ func TestGatewayRoutesGrokImagesAndVideosPathsAreRegistered(t *testing.T) {
}
}
func TestGatewayRoutesCompositeVideoStatusUsesGrokHandler(t *testing.T) {
router := newGatewayRoutesTestRouter(service.PlatformComposite)
for _, path := range []string{
"/v1/videos/request-123",
"/videos/request-123",
} {
req := httptest.NewRequest(http.MethodGet, path, nil)
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
require.NotEqual(t, http.StatusNotFound, w.Code, "path=%s should hit Grok video status handler", path)
require.NotContains(t, w.Body.String(), "not supported for this platform")
}
}
func TestGatewayRoutesNonGrokVideosAreRejectedAtPlatformGate(t *testing.T) {
router := newGatewayRoutesTestRouter(service.PlatformOpenAI)