fix: 将52号接口范围限定为GPU worker

撤回52号网关路由、图片字段改名和mock改动,gateway目录恢复a3fddbb。worker保持base64和null响应,更新接口说明和回归测试。

验证:worker API、IP限制与网关兼容性共54项测试通过。
This commit is contained in:
xsl
2026-11-04 10:45:16 +08:00
parent 5b2b73f5d5
commit 1c51f3eaab
11 changed files with 58 additions and 92 deletions
+9 -7
View File
@@ -1,16 +1,12 @@
"""The legacy interface 5 and new interface 52 forward to separate worker paths."""
"""Interface 52 belongs to the GPU worker; the gateway keeps its legacy routes."""
import asyncio
import importlib
import pytest
from starlette.requests import Request
@pytest.mark.parametrize("name,path", [
("hairline_generate", "/api/v1/hairline/generate"),
("hairline_generate_52", "/api/v1/hairline/generate-52"),
])
def test_distinct_hairline_forwarding(monkeypatch, name, path):
def test_legacy_hairline_forwarding(monkeypatch):
name, path = "hairline_generate", "/api/v1/hairline/generate"
gateway = importlib.import_module("gateway.app")
request = Request({"type": "http", "method": "POST", "path": path, "headers": []})
calls = []
@@ -25,3 +21,9 @@ def test_distinct_hairline_forwarding(monkeypatch, name, path):
assert next(route for route in gateway.app.routes if getattr(route, "path", None) == path).endpoint is endpoint
assert asyncio.run(endpoint(request)) == {"forwarded_to": path}
assert calls == [path]
def test_interface52_is_not_exposed_by_gateway():
gateway = importlib.import_module("gateway.app")
assert not any(getattr(route, "path", None) == "/api/v1/hairline/generate-52"
for route in gateway.app.routes)