fix: preserve composite video content routing
This commit is contained in:
1 parent
cb81e17fea
commit
ca6b192728
2 files changed
+14
-4
No files matched your search
@@ -122,7 +122,10 @@ func RegisterGatewayRoutes(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
videoContentHandler := func(c *gin.Context) {
|
videoContentHandler := func(c *gin.Context) {
|
||||||
if getGroupPlatform(c) == service.PlatformGrok {
|
// Video content requests do not carry a model, so composite groups cannot
|
||||||
|
// be resolved by compositeTargetPlatformMiddleware. Route them through
|
||||||
|
// the Grok handler just like video status lookups.
|
||||||
|
if getGroupPlatform(c) == service.PlatformGrok || getGroupPlatform(c) == service.PlatformComposite {
|
||||||
h.OpenAIGateway.GrokVideoContent(c)
|
h.OpenAIGateway.GrokVideoContent(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func newGatewayRoutesTestRouter(platform ...string) *gin.Engine {
|
func newGatewayRoutesTestRouter(platform ...string) *gin.Engine {
|
||||||
return newGatewayRoutesTestRouterWithConfig(&config.Config{}, platform...)
|
return newGatewayRoutesTestRouterWithConfig(&config.Config{
|
||||||
|
Gateway: config.GatewayConfig{
|
||||||
|
MaxBodySize: 1024 * 1024,
|
||||||
|
TextMaxBodySize: 1024 * 1024,
|
||||||
|
},
|
||||||
|
}, platform...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGatewayRoutesTestRouterWithConfig(cfg *config.Config, platform ...string) *gin.Engine {
|
func newGatewayRoutesTestRouterWithConfig(cfg *config.Config, platform ...string) *gin.Engine {
|
||||||
@@ -177,18 +182,20 @@ func TestGatewayRoutesGrokImagesAndVideosPathsAreRegistered(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGatewayRoutesCompositeVideoStatusUsesGrokHandler(t *testing.T) {
|
func TestGatewayRoutesCompositeVideoLookupsUseGrokHandler(t *testing.T) {
|
||||||
router := newGatewayRoutesTestRouter(service.PlatformComposite)
|
router := newGatewayRoutesTestRouter(service.PlatformComposite)
|
||||||
|
|
||||||
for _, path := range []string{
|
for _, path := range []string{
|
||||||
"/v1/videos/request-123",
|
"/v1/videos/request-123",
|
||||||
"/videos/request-123",
|
"/videos/request-123",
|
||||||
|
"/v1/videos/request-123/content",
|
||||||
|
"/videos/request-123/content",
|
||||||
} {
|
} {
|
||||||
req := httptest.NewRequest(http.MethodGet, path, nil)
|
req := httptest.NewRequest(http.MethodGet, path, nil)
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
require.NotEqual(t, http.StatusNotFound, w.Code, "path=%s should hit Grok video status handler", path)
|
require.NotEqual(t, http.StatusNotFound, w.Code, "path=%s should hit Grok video lookup handler", path)
|
||||||
require.NotContains(t, w.Body.String(), "not supported for this platform")
|
require.NotContains(t, w.Body.String(), "not supported for this platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user