fix(web): 会话步骤明细里的能力 ID 换成能力标题,与最终汇报一致(FIX-9)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c5987a9db3
commit
65a2ed7d49
2 files changed
+25
-2
No files matched your search
@@ -196,7 +196,9 @@ function ToolRow({ call, audit }: { call: ToolCallView; audit?: InvocationAudit
|
|||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const meta = capabilityMeta(call.capabilityId);
|
const meta = capabilityMeta(call.capabilityId);
|
||||||
const denied = isDenied(call);
|
const denied = isDenied(call);
|
||||||
const summary = denied ? deniedReason(call).text : toolSummary(call);
|
const raw = denied ? deniedReason(call).text : toolSummary(call);
|
||||||
|
// 旧会话的错误文字里带能力 ID / 原因码:和最终汇报一样换成能力标题与人话
|
||||||
|
const summary = raw ? humanizeReport(raw).text : raw;
|
||||||
return (
|
return (
|
||||||
<li className="min-w-0">
|
<li className="min-w-0">
|
||||||
<button
|
<button
|
||||||
@@ -319,7 +321,7 @@ export function StepSummary({
|
|||||||
key={a.key}
|
key={a.key}
|
||||||
className="line-clamp-3 px-1 py-1 text-meta break-words whitespace-pre-wrap text-muted-foreground"
|
className="line-clamp-3 px-1 py-1 text-meta break-words whitespace-pre-wrap text-muted-foreground"
|
||||||
>
|
>
|
||||||
{a.text.trim()}
|
{humanizeReport(a.text.trim()).text}
|
||||||
</li>
|
</li>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -571,3 +571,24 @@ describe("进度行时长(FIX-9):从这一轮开始算到结论正文", () => {
|
|||||||
expect(t).toMatch(/· 7 秒/);
|
expect(t).toMatch(/· 7 秒/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("步骤明细(FIX-9):能力 ID 换成能力标题", () => {
|
||||||
|
it("失败原因与工具之间的话里的能力 ID 走能力标题", () => {
|
||||||
|
const activity: ActivityItem[] = [
|
||||||
|
{ kind: "note", key: "n1", text: "site.health_check 被拒,改用 site.list。", at: AT },
|
||||||
|
{
|
||||||
|
kind: "tool",
|
||||||
|
key: "c1",
|
||||||
|
call: call({
|
||||||
|
capabilityId: "download.inspect",
|
||||||
|
status: "failed",
|
||||||
|
outputSummary: '{"error":{"code":"x","message":"site.health_check 调用失败"}}',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const t = text(render(createElement(StepSummary, { activity, running: false })));
|
||||||
|
expect(t).not.toContain("site.health_check");
|
||||||
|
expect(t).not.toContain("site.list");
|
||||||
|
expect(t).toContain("检测站点 被拒");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in new issue
Block a user