diff --git a/packages/agent-chat/src/ComputerManagePanel.tsx b/packages/agent-chat/src/ComputerManagePanel.tsx index eb50b37..d77982f 100644 --- a/packages/agent-chat/src/ComputerManagePanel.tsx +++ b/packages/agent-chat/src/ComputerManagePanel.tsx @@ -45,9 +45,11 @@ const copy = { screen: "Open computer screen", screenAt: "Open computer screen · {rate}/hr", pause: "Pause", + pauseAt: "Pause · {rate}/hr", pausing: "Pausing…", pauseFailed: "The computer did not pause.", resume: "Resume", + resumeAt: "Resume · {rate}/hr", resuming: "Resuming…", resumeFailed: "The computer did not resume.", resumeConfirm: "Resume bills {rate} credits per hour. Unused prepaid is returned.", @@ -80,9 +82,11 @@ const copy = { screen: "打开电脑屏幕", screenAt: "打开电脑屏幕 · {rate} 星币/小时", pause: "暂停", + pauseAt: "暂停 · {rate} 星币/小时", pausing: "正在暂停…", pauseFailed: "没有停下来。", resume: "恢复", + resumeAt: "恢复 · {rate} 星币/小时", resuming: "正在恢复…", resumeFailed: "没有恢复。", resumeConfirm: "恢复按 {rate} 星币/小时计费。不用的预扣会退回。", @@ -363,7 +367,12 @@ export function ComputerManagePanel({ void pauseThis(row.computer_id); }} > - {busy ? t.pausing : t.pause} + {busy + ? t.pausing + : pauseAsksBeforeCharge(row.paused_credits_per_hour) && + row.paused_credits_per_hour != null + ? withRate(t.pauseAt, row.paused_credits_per_hour) + : t.pause} ) : row.has_disk ? ( ) : null} {computerStatusLine(row, t)} diff --git a/tests/computer-manage-cta.test.cjs b/tests/computer-manage-cta.test.cjs index 6a867f3..b8ad5e3 100644 --- a/tests/computer-manage-cta.test.cjs +++ b/tests/computer-manage-cta.test.cjs @@ -96,8 +96,11 @@ test("a running computer can be paused from the panel", () => { "utf8", ); assert.match(panel, /pause: "暂停"/); + assert.match(panel, /pauseAt: "暂停 · \{rate\} 星币\/小时"/); assert.match(panel, /\/api\/computers\/\$\{encodeURIComponent\(computerId\)\}\/pause/); assert.match(panel, /row\.status === "running"/); + assert.match(panel, /pauseAsksBeforeCharge\(row\.paused_credits_per_hour\) &&/); + assert.match(panel, /withRate\(t\.pauseAt, row\.paused_credits_per_hour\)/); }); test("pause asks before a charged pause and skips a free one", () => { @@ -119,8 +122,10 @@ test("an idle computer with a disk can be resumed from the panel", () => { "utf8", ); assert.match(panel, /resume: "恢复"/); + assert.match(panel, /resumeAt: "恢复 · \{rate\} 星币\/小时"/); assert.match(panel, /\/api\/computers\/\$\{encodeURIComponent\(computerId\)\}\/resume/); assert.match(panel, /row\.has_disk \? \(/); + assert.match(panel, /withRate\(t\.resumeAt, row\.resume_credits_per_hour\)/); }); test("resuming asks on the panel before it starts billing", () => {