Files
AgentLab/frontend/src/api/whatif.ts
T
ThearchyHelios 633af950db 数字推演复核修正(第 1 轮,界面):整份结果在推演区里勾行,只让用到的行可勾,勾完结果就在手边,加载中和失败后不摆上一次的答复
- 整份结果、数组字段作输入时,输入下面给「勾选要排除的行(共 N 行)」,按页取整份快照来勾:证据链里没有它的查询步骤、
  或者查询步骤只给前后 2 行时也勾得全
- 查询步骤里的勾行表格只让这个指标用到的行可勾(row_span),别的行禁用并说明没用到,勾了也不发请求
- 勾行表格底下带推演结果(旧值 → 新值或原因)和「回到推演结果」;勾完、答复回来后各把它带进视野一次(答复回来时上面
  的内容会变高,把表格往下挤)
- 推演的请求和答复提到片段那一层,推演区和查询步骤共用一份;答复回来之前随改动变的部分变淡、标为忙,请求失败时结果、
  排除标记、报告中会变的地方、下游口径卡都不显示,不拿上一次的答复充数
- 整个指标推演不了(口径卡没记输入)时只说原因,不再同时写「无可推演」和「无变化」,也不画勾选框
- 快照读不出来的输入写「查询快照无法核对,不显示原值」;没有能改的输入、也没有能勾的行时说一句为什么
- check-whatif 补对应检查:整份结果勾行、上下文行不能勾、勾完结果整个在视野里、封存核对未通过、加载中和失败后、整个
  指标推演不了、窄屏里的勾行表格;ESTIMATE 按实测改成 28 秒
2026-10-05 05:43:17 +08:00

25 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 数字推演的接口(/api/runs/{run_id}/evidence/whatif),挂在 api.whatif 上。推演只读:不写运行记录、不改报告。
*
* 请求函数(get / post / del……)和 ApiError 从 ./http 导入,不要从 ./client 导入:client.ts 要导入
* 这个文件把它挂到 api 上,反过来导入就成了循环(见 http.ts 开头的说明)。
*/
import type { WhatIfRequest, WhatIfResult, WhatIfRowsPage } from '../types'
import { get, request } from './http'
export const whatif = {
/**
* 在一次运行的口径卡上推演。signal 用来丢掉过时的请求:输入还在改、又发了新的一次时,上一次的答复不再要。
* 取消照旧抛 AbortError(request 不把它当成连不上服务端)
*/
run: (runId: string, body: WhatIfRequest, opts?: { signal?: AbortSignal }) =>
request<WhatIfResult>(`/runs/${encodeURIComponent(runId)}/evidence/whatif`, {
method: 'POST', body: JSON.stringify(body), signal: opts?.signal,
}),
/** 一页查询快照的行(从第 offset 行起最多 limit 行,行号从 0 数):推演区里给整份结果、数组字段勾行用 */
rows: (runId: string, artifact: string, page: { offset: number; limit: number }, opts?: { signal?: AbortSignal }) =>
get<WhatIfRowsPage>(`/runs/${encodeURIComponent(runId)}/evidence/whatif/rows?${new URLSearchParams({
artifact, offset: String(page.offset), limit: String(page.limit),
})}`, { signal: opts?.signal }),
}