feat(web): read host stats and the bare models endpoint on the status page
The metrics tiles now prefer the daemon's own sample (`resources.system`, then `info.cpu/mem/disk`) over the old RSS-over-physical-memory guess, and each tile gained the detail that makes the number actionable: cores and 1-minute load, used/total bytes, the filesystem the disk figure describes. The models card stops asking for a workspace it does not have. It calls the bare endpoint (no spawn), polls every 1.5 s while the plugin's cache is still filling (bounded to 12 rounds), and tells the three empty states apart instead of showing one generic "no models": still fetching, no live instance, no live session. With no workspace to key on, `fetchModels` also tolerates a legacy daemon that requires the parameter, retrying with the first visible workspace. Smaller fixes that fell out of the same read: `formatBytes` printed "4.00 GiB" for a whole number of GiB, and the workspaces query now polls every 5 s only while the socket is down, so a dropped connection still refreshes the page.
This commit is contained in:
1 parent
b577e15f6d
commit
604fec5ea0
10 files changed
+560
-105
No files matched your search
@@ -73,14 +73,14 @@ export function StatusPage() {
|
||||
const pairCode = usePairCodeQuery(paired);
|
||||
|
||||
const workspaces = workspacesQuery.data ?? [];
|
||||
// Counters, the models probe and the task list only consider the rows the
|
||||
// workspace-noise policy keeps in the default view: a ghost or a /tmp
|
||||
// scratch dir must not become the "first workspace" used for `/models`.
|
||||
// Counters and the task list only consider the rows the workspace-noise
|
||||
// policy keeps in the default view.
|
||||
const { primary: visibleWorkspaces } = partitionWorkspaces(workspaces);
|
||||
const workspaceCount = visibleWorkspaces.length;
|
||||
const sessionCount = visibleWorkspaces.reduce((total, workspace) => total + (workspace.sessionCount || 0), 0);
|
||||
const modelsWorkspaceId = visibleWorkspaces[0]?.workspaceId ?? null;
|
||||
const models = useModelsQuery(modelsWorkspaceId);
|
||||
// Models: use the bare /api/v1/models endpoint — the daemon scans ready
|
||||
// instances without spawning, so we never get E_INSTANCE_STARTING here.
|
||||
const models = useModelsQuery(visibleWorkspaces[0]?.workspaceId ?? null, paired);
|
||||
|
||||
const meta = useMemo(() => readPairMeta(), []);
|
||||
|
||||
@@ -221,7 +221,9 @@ export function StatusPage() {
|
||||
<div className="status-col">
|
||||
<ModelsCard
|
||||
providers={models.data?.providers ?? []}
|
||||
loading={Boolean(modelsWorkspaceId) && models.isPending}
|
||||
loading={models.isPending && models.data === undefined}
|
||||
pending={models.data?.pending === true}
|
||||
pendingReason={models.data?.pendingReason ?? null}
|
||||
error={models.isError ? translatedError(models.error, "status.modelsError", t) : null}
|
||||
onRetry={() => void models.refetch()}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user