From 1e1798d90d4dffd37b53fc0d5642afa9960c0ecc Mon Sep 17 00:00:00 2001 From: zninggo Date: Sat, 15 Aug 2026 01:12:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(gateway):=20Composite=20=E5=88=86=E7=BB=84?= =?UTF-8?q?=E6=94=BE=E8=A1=8C=E8=A7=86=E9=A2=91=E7=94=9F=E6=88=90=E7=AB=AF?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 视频状态(/videos/:id)与内容下载(/videos/:id/content)都已放行 PlatformComposite, 唯独创建端点仅放行 PlatformGrok. Composite 分组 用户配好模型路由后可查询可下载, 唯独创建 404. 补齐放行判断, 与另外两个视频端点保持一致; 其他平台行为不变. --- backend/internal/server/routes/gateway.go | 5 ++++- backend/internal/server/routes/gateway_test.go | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/internal/server/routes/gateway.go b/backend/internal/server/routes/gateway.go index 6d99d2c7e..0d35a7a48 100644 --- a/backend/internal/server/routes/gateway.go +++ b/backend/internal/server/routes/gateway.go @@ -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 } diff --git a/backend/internal/server/routes/gateway_test.go b/backend/internal/server/routes/gateway_test.go index ded7bd298..7fb127ccc 100644 --- a/backend/internal/server/routes/gateway_test.go +++ b/backend/internal/server/routes/gateway_test.go @@ -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)