数据链路 P1 修复:ETag 缓存 + 校准漂移检测

P1-5 ETag 支持:
- 后端新增 _etag_middleware:GET /api/* 自动返回 ETag (MD5)
- 支持 If-None-Match 请求头,匹配时返回 304 + 30s Cache-Control
- 前端 cache: no-store → default,浏览器自动处理 ETag/304 节省带宽

P1-6 校准漂移检测:
- probability_calibration.py 新增 check_calibration_drift()
- 对比最近 200 条 daily_records 的 CRPS 与校准基线
- 漂移 >15% 时返回 warning 提示重新训练
- 集成到 /api/system/status 的 probability.drift 字段

Tested: python -m ruff check ., npx tsc --noEmit
This commit is contained in:
2569718930@qq.com
2026-05-10 16:54:48 +08:00
parent c0bb2acf78
commit b3ea8dcfa7
4 changed files with 135 additions and 6 deletions
+3 -3
View File
@@ -68,7 +68,7 @@ async function fetchJson<T>(url: string, options?: { timeoutMs?: number }): Prom
try {
response = await fetchBackendApi(url, {
headers,
cache: "no-store",
cache: "default",
signal: controller?.signal,
});
} catch (error) {
@@ -238,7 +238,7 @@ export const dashboardClient = {
void fetch(`/api/system/priority-warm?${params.toString()}`, {
method: "POST",
headers: { Accept: "application/json" },
cache: "no-store",
cache: "default",
keepalive: true,
}).catch(() => {});
},
@@ -418,7 +418,7 @@ export const dashboardClient = {
}).then((headers) => fetchBackendApi("/api/scan/terminal/ai", {
method: "POST",
headers,
cache: "no-store",
cache: "default",
body: JSON.stringify({
filters: payload.filters,
snapshot_id: snapshotId || null,