mirror of
https://github.com/PawanOsman/ChatGPT.git
synced 2026-07-18 08:05:57 +02:00
Refactor subStatus handling in SidebarProvider for improved clarity
- Updated the logic for determining the `subStatus` in the `SidebarProvider` to streamline the assignment process. - Enhanced readability by consolidating the conditional checks for `subStatus`, ensuring consistent status updates for tasks and cancellations. - Maintained existing functionality while improving code maintainability and clarity.
This commit is contained in:
@@ -247,13 +247,15 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
|
||||
hit = true;
|
||||
changed = true;
|
||||
const timedOut = data.reason === "timeout";
|
||||
const subStatus =
|
||||
b.name === "Task" || b.name === "task" || b.subStatus
|
||||
? (timedOut ? ("error" as const) : ("cancelled" as const))
|
||||
: b.subStatus;
|
||||
return {
|
||||
...b,
|
||||
status: "error" as const,
|
||||
result: b.result || (timedOut ? `(timeout after ${Math.round((b.timeoutMs || 0) / 1000)}s)` : "(cancelled)"),
|
||||
subStatus: (b.name === "Task" || b.name === "task" || b.subStatus)
|
||||
? (timedOut ? "error" : "cancelled") as const
|
||||
: b.subStatus,
|
||||
subStatus,
|
||||
};
|
||||
});
|
||||
return changed ? { ...turn, blocks } : turn;
|
||||
|
||||
Reference in New Issue
Block a user