Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coding/proxy/server/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ def _build_favicon() -> bytes:
}).catch(function() {});
}
tick();
_mcTimer = setInterval(tick, 1500);
_mcTimer = setInterval(tick, 10000);
}
function stopModelCallingPoll() {
if (_mcTimer) { clearInterval(_mcTimer); _mcTimer = null; }
Expand Down
10 changes: 7 additions & 3 deletions src/coding/proxy/server/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import httpx
from fastapi import Request, Response
from fastapi.responses import StreamingResponse
from fastapi.responses import RedirectResponse, StreamingResponse

from ..vendors.base import NoCompatibleVendorError

Expand Down Expand Up @@ -197,11 +197,15 @@ async def health() -> dict:
return {"status": "ok"}

@app.head("/")
@app.get("/")
async def root() -> Response:
async def root_head() -> Response:
"""根路径连通性探测 — Claude Code 在建连前发送 HEAD / 作为 health probe."""
return Response(status_code=200)

@app.get("/")
async def root_get() -> RedirectResponse:
"""GET / 重定向到 Dashboard."""
return RedirectResponse(url="/dashboard", status_code=307)


def register_status_route(app: Any, router: Any) -> None:
"""注册状态查询路由."""
Expand Down
7 changes: 5 additions & 2 deletions tests/e2e/test_e2e_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ async def test_http_health_probe(e2e_client: object) -> None:
)

get_resp = await e2e_client.get("/")
assert get_resp.status_code == 200, f"GET / 预期 200,实际 {get_resp.status_code}"
assert get_resp.status_code == 307, f"GET / 预期 307,实际 {get_resp.status_code}"
assert get_resp.headers["location"] == "/dashboard"

health_resp = await e2e_client.get("/health")
assert health_resp.status_code == 200
assert health_resp.json() == {"status": "ok"}

print("\n[E2E] HTTP health probe 成功: HEAD /=200, GET /=200, /health=ok")
print(
"\n[E2E] HTTP health probe 成功: HEAD /=200, GET /=307→/dashboard, /health=ok"
)


@pytest.mark.e2e
Expand Down
9 changes: 5 additions & 4 deletions tests/test_app_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def test_head_root_returns_200():
assert resp.status_code == 200


def test_get_root_returns_200():
"""GET / 返回 200."""
def test_get_root_redirects_to_dashboard():
"""GET / 重定向到 /dashboard."""
with _make_app() as client:
resp = client.get("/")
assert resp.status_code == 200
resp = client.get("/", follow_redirects=False)
assert resp.status_code == 307
assert resp.headers["location"] == "/dashboard"


# ── count_tokens 透传 ────────────────────────────────────────
Expand Down
Loading