mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-23 16:31:59 +00:00
最终验收:148 项逐条复核(原审查 142 条 + 平台问题 6 条),返工后 145 项解决
四组验收员拿审查原文在沙箱里逐条复现:133 项已解决、15 项部分解决、没有未解决或回退的; 另发现 10 个新问题。按归属返工后,剩 3 项低严重度:MCP / 自定义工具的危险标记(待用户拍板)、 选中环与运行态同色(需跨三处协调改)、「接着跑」这个说法是否更换(多处引用原文,暂留)。 这次返工改了 - 右栏:老运行没有 active_ms 时执行时长改按航迹算,不再显示最后一段的「22 ms」;循环出口行不再差一; 取消在一轮中途时泳道脚注不写「0 ms」;分支、循环出口显示 case 的说明而不是 key; 展开已完成轮次不再误报「N 条新进展」;旧数据里已完成的模型调用不再一律标成「已取消」 - 后端:跳过事件带节点名和类型;restore 版本时把已发布 / 受管退回草稿;只是打开旧会话不再把它顶到最前、 标成「刚刚」;协作团队全程没有成员交付成果、调度者却判完成时按失败或降档处理,不再当成功交付 - 画布:循环体有「循环体 · 最多 N 轮」的底框,出口标签不再被自己的走线穿过;运行中校验角标退让; 768 宽下工具栏不溢出;运行被拦时点名是哪个节点;正式运行弹层写明以谁的名义发起 - 问数据:离线时能力条不把「没取回来」说成 0;窄屏下会话列表收起;check-chat 在零点前后不再误报 - 公共层:FastAPI 422 校验错误翻成中文,不再把英文原文透给用户 验证(沙箱):tsc 干净,pytest 878 passed(两遍),check-all 15 项检查全绿。
This commit is contained in:
+12
-14
@@ -4,6 +4,7 @@ import type {
|
||||
ValidationIssue, VarIssue, Variable, Workflow, WorkflowVersion,
|
||||
} from '../types'
|
||||
import { localActor } from '../lib/actor'
|
||||
import { VALIDATION_TITLE, describeValidation } from '../lib/validation'
|
||||
|
||||
const BASE = '/api'
|
||||
|
||||
@@ -69,16 +70,13 @@ function actorHeader(): Record<string, string> {
|
||||
return actor ? { 'X-Actor': encodeURIComponent(actor) } : {}
|
||||
}
|
||||
|
||||
/** FastAPI 的 422 是 [{loc, msg, type}] 数组,直接 String() 会变成 [object Object] */
|
||||
function describeDetail(detail: unknown): string {
|
||||
/**
|
||||
* FastAPI 的 422 是 [{loc, msg, type}] 数组:直接 String() 是 [object Object],照拼 msg
|
||||
* 又是 pydantic 的英文原文。按 type 翻成中文(lib/validation),path 用来查表单上的叫法
|
||||
*/
|
||||
function describeDetail(detail: unknown, path?: string): string {
|
||||
if (typeof detail === 'string') return detail
|
||||
if (Array.isArray(detail)) {
|
||||
const parts = detail.map((d: any) => {
|
||||
const loc = Array.isArray(d?.loc) ? d.loc.filter((x: unknown) => x !== 'body' && x !== 'query').join('.') : ''
|
||||
return loc ? `${loc}:${d?.msg ?? ''}` : String(d?.msg ?? JSON.stringify(d))
|
||||
})
|
||||
return `提交的内容不符合要求:${parts.join(';')}`
|
||||
}
|
||||
if (Array.isArray(detail)) return `${VALIDATION_TITLE}:${describeValidation(detail, path).join(';')}`
|
||||
try { return JSON.stringify(detail) } catch { return String(detail) }
|
||||
}
|
||||
|
||||
@@ -132,7 +130,7 @@ async function request<T>(path: string, init?: RequestInit & { timeoutMs?: numbe
|
||||
} finally {
|
||||
if (timer) clearTimeout(timer)
|
||||
}
|
||||
if (!res.ok) throw failure(res.status, res.statusText, await res.text().catch(() => ''))
|
||||
if (!res.ok) throw failure(res.status, res.statusText, await res.text().catch(() => ''), path)
|
||||
report(true)
|
||||
if (res.status === 204) return undefined as T
|
||||
return res.json()
|
||||
@@ -145,7 +143,7 @@ const codeOf = (body: unknown): string | undefined => {
|
||||
}
|
||||
|
||||
/** 非 2xx 的响应 → ApiError,顺带报告连接状态。fetch 和 XHR 两条路共用 */
|
||||
function failure(status: number, statusText: string, text: string): ApiError {
|
||||
function failure(status: number, statusText: string, text: string, path?: string): ApiError {
|
||||
let body: any
|
||||
let isJson = false
|
||||
try { body = JSON.parse(text); isJson = true } catch { /* 响应体不是 JSON */ }
|
||||
@@ -159,7 +157,7 @@ function failure(status: number, statusText: string, text: string): ApiError {
|
||||
report(true)
|
||||
if (isJson) {
|
||||
const detail = body?.detail ?? body
|
||||
return new ApiError(status, describeDetail(detail), {
|
||||
return new ApiError(status, describeDetail(detail, path), {
|
||||
detail, raw: typeof body?.raw === 'string' ? body.raw : `${status} ${text.slice(0, 2000)}`,
|
||||
code: codeOf(body),
|
||||
})
|
||||
@@ -214,7 +212,7 @@ function upload<T>(path: string, form: FormData, opts?: UploadOptions): Promise<
|
||||
xhr.onload = () => {
|
||||
cleanup()
|
||||
if (xhr.status < 200 || xhr.status >= 300) {
|
||||
reject(failure(xhr.status, xhr.statusText, xhr.responseText ?? ''))
|
||||
reject(failure(xhr.status, xhr.statusText, xhr.responseText ?? '', path))
|
||||
return
|
||||
}
|
||||
report(true)
|
||||
@@ -761,7 +759,7 @@ export function streamCopilot(
|
||||
return
|
||||
}
|
||||
report(true)
|
||||
onEnd(isJson ? describeDetail(body?.detail ?? body)
|
||||
onEnd(isJson ? describeDetail(body?.detail ?? body, '/copilot/generate-stream')
|
||||
: res.status >= 500 ? `后端出错了(${res.status}),详情看服务日志`
|
||||
: `请求没有成功(${res.status} ${res.statusText})`, { status: res.status, code: isJson ? codeOf(body) : undefined })
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user