## 场景模板库(S4-1)
- scenarios/templates.py: 6 个内置模板
- 单轮问答基础 / 多轮对话 / 动态 LLM 生成 / 安全合规检测 / JSON 接口校验 / 加权评分
- 每个模板附带对应规则配置(含 v0.3 新规则)
- routers/scenarios.py: GET /api/scenarios/templates + GET /api/scenarios/templates/{id}
- api.ts: scenariosApi.listTemplates() / getTemplate()
- Scenarios.tsx: 「从模板新建」按钮 + 卡片式模板选择弹窗
- 选择后预填名称/描述/标签/cases JSON/llm_config,直接进入编辑 Drawer
## WebSocket 自动重连(S4-2)
- useRunSession.ts: connectWs() 函数 + 指数退避重连
- 异常断开(非 1000/clean)时自动重试,最多 5 次
- 延迟:1s → 2s → 4s → 8s → 16s(上限 30s)
- 超出重试次数后降级 REST 获取最终状态
- reconnectTimerRef 在组件卸载时清理,无内存泄漏
## PageWrapper 复用(S4-3)
- PageWrapper.tsx: 升级 inline 模式匹配全高页面的 padding 页头样式
- Home / Targets / Scenarios: 用 PageWrapper inline+fullHeight 替换重复内联页头
- Home.tsx: 去掉 unused `colors` import
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| files.py | ||
| proxy.py | ||
| reports.py | ||
| runs.py | ||
| scenarios.py | ||
| stats.py | ||
| targets.py | ||