mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(copilot): toast when cancel confirmation times out
Check the reason field in the cancel response — if "cancel_published_not_confirmed", show a non-destructive toast so the user knows the stop was sent but not yet confirmed by the executor.
This commit is contained in:
@@ -122,7 +122,11 @@ export function useCopilotPage() {
|
||||
parts: msg.parts.map((part) =>
|
||||
"state" in part &&
|
||||
(part.state === "input-streaming" || part.state === "input-available")
|
||||
? { ...part, state: "output-error" as const, errorText: "Cancelled" }
|
||||
? {
|
||||
...part,
|
||||
state: "output-error" as const,
|
||||
errorText: "Cancelled",
|
||||
}
|
||||
: part,
|
||||
),
|
||||
})),
|
||||
@@ -130,7 +134,18 @@ export function useCopilotPage() {
|
||||
|
||||
if (!sessionId) return;
|
||||
try {
|
||||
await postV2CancelSessionTask(sessionId);
|
||||
const res = await postV2CancelSessionTask(sessionId);
|
||||
if (
|
||||
res.status === 200 &&
|
||||
"reason" in res.data &&
|
||||
res.data.reason === "cancel_published_not_confirmed"
|
||||
) {
|
||||
toast({
|
||||
title: "Stop may take a moment",
|
||||
description:
|
||||
"The cancel was sent but not yet confirmed. The task should stop shortly.",
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
toast({
|
||||
title: "Could not stop the task",
|
||||
|
||||
Reference in New Issue
Block a user