pi-spark 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/screenshot.png
CHANGED
|
Binary file
|
|
@@ -47,7 +47,7 @@ export async function fetchCodexUsage(token: string, accountId?: string, parentS
|
|
|
47
47
|
if (accountId) headers["ChatGPT-Account-Id"] = accountId;
|
|
48
48
|
|
|
49
49
|
const response = await fetch(USAGE_URL, { method: "GET", headers, signal: AbortSignal.any(signals) });
|
|
50
|
-
if (!response.ok) throw new Error(
|
|
50
|
+
if (!response.ok) throw new Error("request failed");
|
|
51
51
|
|
|
52
52
|
return normalizeUsage((await response.json()) as CodexUsageResponse);
|
|
53
53
|
}
|
|
@@ -19,11 +19,11 @@ export function renderUsage(theme: Theme, usage: CodexUsage): string {
|
|
|
19
19
|
|
|
20
20
|
/** Render a footer status string for a usage fetch error. */
|
|
21
21
|
export function renderError(theme: Theme, message: string): string {
|
|
22
|
-
return
|
|
22
|
+
return theme.fg("error", `${LABEL} usage unavailable: ${message}`);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function renderLane(theme: Theme, label: string, percent: number | undefined): string {
|
|
26
|
-
const text = `${label} ${percent === undefined ? "?" : percent.toFixed(
|
|
26
|
+
const text = `${label} ${percent === undefined ? "?" : percent.toFixed(0)}%`;
|
|
27
27
|
|
|
28
28
|
if (percent && percent > 90) return theme.fg("error", text);
|
|
29
29
|
if (percent && percent > 70) return theme.fg("warning", text);
|