fix(gateway): Composite 分组放行视频生成端点

视频状态(/videos/:id)与内容下载(/videos/:id/content)都已放行
PlatformComposite, 唯独创建端点仅放行 PlatformGrok. Composite 分组
用户配好模型路由后可查询可下载, 唯独创建 404.

补齐放行判断, 与另外两个视频端点保持一致; 其他平台行为不变.
This commit is contained in:
zninggo
2026-08-15 01:20:26 +08:00
parent fbfdcef818
commit 1e1798d90d
2 changed files with 16 additions and 1 deletions
+4 -1
View File
@@ -93,7 +93,10 @@ func RegisterGatewayRoutes(
}
}
videoGenerationHandler := func(c *gin.Context) {
if getGroupPlatform(c) == service.PlatformGrok {
// Video status/content lookups below already allow Composite groups; keep
// task creation aligned so composite keys that route to Grok accounts can
// submit video generation jobs.
if platform := getGroupPlatform(c); platform == service.PlatformGrok || platform == service.PlatformComposite {
h.OpenAIGateway.GrokVideoGeneration(c)
return
}
@@ -345,6 +345,18 @@ func TestGatewayRoutesNonGrokVideosAreRejectedAtPlatformGate(t *testing.T) {
}
}
func TestGatewayRoutesCompositeVideoGenerationAllowed(t *testing.T) {
router := newGatewayRoutesTestRouter(service.PlatformComposite)
req := httptest.NewRequest(http.MethodPost, "/v1/videos/generations", strings.NewReader(`{"model":"grok-imagine-video-1.5","prompt":"waves"}`))
req.Header.Set("Content-Type", "application/json")
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
require.NotEqual(t, http.StatusNotFound, w.Code)
require.NotContains(t, w.Body.String(), "not supported")
}
func TestGatewayRoutesCompositeOpenAIOnlyEndpointsRequireOpenAITarget(t *testing.T) {
router := newGatewayRoutesTestRouter(service.PlatformComposite)