Skip to content

Comments

Fix Compute Tab for a local provider#1390

Open
deep1401 wants to merge 5 commits intomainfrom
fix/local-provider-compute
Open

Fix Compute Tab for a local provider#1390
deep1401 wants to merge 5 commits intomainfrom
fix/local-provider-compute

Conversation

@deep1401
Copy link
Member

@deep1401 deep1401 commented Feb 24, 2026

  • This also deletes ModelVramSidebar and Diffusion components

Summary by CodeRabbit

  • New Features

    • Local machine summary UI, local-provider card, navigation and back button.
  • Removed Features

    • Diffusion image-generation UI, history viewer, inpainting and related modals.
    • VRAM estimation feature and sidebar (model memory estimator).
  • Bug Fixes

    • Server info now consistently includes full system metrics.
  • Refactor

    • Simplified header stats and streamlined connection/announcement logic.

@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3219ef8 and e670844.

📒 Files selected for processing (5)
  • api/pyproject.toml
  • api/transformerlab/routers/model.py
  • api/transformerlab/schemas/vram.py
  • api/transformerlab/services/vram_service.py
  • src/renderer/lib/api-client/endpoints.ts
💤 Files with no reviewable changes (5)
  • src/renderer/lib/api-client/endpoints.ts
  • api/pyproject.toml
  • api/transformerlab/schemas/vram.py
  • api/transformerlab/routers/model.py
  • api/transformerlab/services/vram_service.py

📝 Walkthrough

Walkthrough

Always fetches and composes dynamic server/system metrics (removing multiuser short-circuits), removes diffusion UI and related components, adds a LocalMachineSummary UI with navigation, relocates ModelGalleryEntry and deletes ModelVramSidebar, and simplifies several client components and hooks tied to server stats.

Changes

Cohort / File(s) Summary
Server info & auth client
api/transformerlab/routers/serverinfo.py, src/renderer/lib/api-client/functions.ts, src/renderer/lib/api-client/hooks.ts, src/renderer/lib/authContext.ts
Removed multiuser early-return/short-circuits so server/info is always composed/fetched; simplified useServerStats URL logic and allowed server/info calls in multiuser flows.
Local machine UI & navigation
src/renderer/components/Compute/LocalMachineSummary.tsx, src/renderer/components/Compute/Resources.tsx, src/renderer/components/Computer.tsx
Added LocalMachineSummary component, integrated it into Resources with navigation to /computer, and added a back button in the Computer header.
Diffusion feature removal
src/renderer/components/Experiment/Diffusion/Diffusion.tsx, src/renderer/components/Experiment/Diffusion/History.tsx, src/renderer/components/Experiment/Diffusion/HistoryImageViewModal.tsx, src/renderer/components/Experiment/Diffusion/Inpainting.tsx, src/renderer/components/MainAppPanel.tsx
Deleted Diffusion UI, history viewer, image-view modal, and inpainting components; removed Diffusion route/imports from app routing.
RunModel / Foundation tweak
src/renderer/components/Experiment/Foundation/RunModelButton.tsx
Removed diffusion-model validity check and its success-alert branch; simplified engine-selection rendering.
Header / StatsBar simplification
src/renderer/components/Header.tsx
Removed server-stats/GPU/VRAM rendering from StatsBar and changed its signature to accept only connection; updated call site accordingly.
Model Zoo refactor
src/renderer/components/ModelZoo/ModelGroups.tsx, src/renderer/components/ModelZoo/ModelStore.tsx, src/renderer/components/ModelZoo/ModelVramSidebar.tsx
Moved ModelGalleryEntry type into ModelGroups, removed ModelVramSidebar component and its VRAM-estimate UI, and updated imports/usages in ModelStore.
VRAM service & API removal
api/transformerlab/services/vram_service.py, api/transformerlab/schemas/vram.py, api/transformerlab/routers/model.py, src/renderer/lib/api-client/endpoints.ts, api/pyproject.toml
Removed VRAM estimation service, schemas, router endpoint, client endpoint builder, and the do-i-have-the-vram dependency.
UI simplifications (Announcements / Welcome)
src/renderer/components/Shared/AnnouncementsModal.tsx, src/renderer/components/Welcome/Welcome.tsx
Removed dependencies on server stats in side effects, simplified connection checks, removed model-recommendation helpers, and replaced dynamic recommendations with static guidance.
Minor UI & routing edits
src/renderer/components/MainAppPanel.tsx, other header/router small edits
Removed Diffusion route and adjusted call sites to match simplified components/hooks.

Sequence Diagram(s)

(Note: visualizes the changed server/info fetch flow across components)

sequenceDiagram
  autonumber
  participant Renderer as Client (Renderer)
  participant Auth as AuthContext
  participant API as API Client (endpoints/functions)
  participant Server as Server (/server/info)

  Renderer->>Auth: requestServerInfo()
  Auth->>API: build/fetch `/server/info`
  API->>Server: GET /server/info
  Server-->>API: dynamic system metrics (CPU, MEM, Disk, GPU...)
  API-->>Auth: payload
  Auth-->>Renderer: server info response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I nibble bytes beneath the moon,
I pruned some panes and tuned a tune,
Machines now tell their whirring tale,
Old galleries closed, new paths set sail,
I hop away — a happy tune! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix Compute Tab for a local provider' accurately reflects the main objective of the changeset, which adds LocalMachineSummary component and navigation to the Compute tab for local provider type.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/local-provider-compute

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
src/renderer/components/ModelZoo/ModelGroups.tsx (2)

268-282: ⚠️ Potential issue | 🟡 Minor

Replace any with a proper type for the model parameter.

Both getLicenseOptions and getArchitectureOptions use any[] / any for the models parameter, violating the project's no-any guideline. A minimal interface (or a Pick of ModelGalleryEntry) is sufficient.

♻️ Proposed fix
-  const getLicenseOptions = (models: any[]): string[] => {
+  const getLicenseOptions = (models: Pick<ModelGalleryEntry, 'license'>[]): string[] => {
     const lowercaseSet = new Set<string>();
-    models?.forEach((m: any) => {
+    models?.forEach((m) => {
       if (m.license) lowercaseSet.add(m.license.toLowerCase());
     });
     return Array.from(lowercaseSet).sort();
   };

-  const getArchitectureOptions = (models: any[]): string[] => {
+  const getArchitectureOptions = (models: Pick<ModelGalleryEntry, 'architecture'>[]): string[] => {
     const lowercaseSet = new Set<string>();
-    models?.forEach((m: any) => {
+    models?.forEach((m) => {
       if (m.architecture) lowercaseSet.add(m.architecture.toLowerCase());
     });
     return Array.from(lowercaseSet).sort();
   };

As per coding guidelines: "Avoid using any type in TypeScript; define interfaces for all props and API responses to ensure type safety."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/ModelZoo/ModelGroups.tsx` around lines 268 - 282, The
helper functions getLicenseOptions and getArchitectureOptions should not use
any[]; replace the parameter type with a strict model shape such as an interface
or a Pick of the existing ModelGalleryEntry (e.g., Pick<ModelGalleryEntry,
'license' | 'architecture'>[]) and update the loop variable types accordingly
(replace m: any with m: Pick<ModelGalleryEntry, 'license' | 'architecture'>).
Ensure both function signatures and the internal usage reference that type so
TypeScript enforces presence/optional of license/architecture fields.

841-841: ⚠️ Potential issue | 🟡 Minor

Guard against NaN when size_of_model_in_mb is undefined.

size_of_model_in_mb is optional in ModelGalleryEntry, so undefined * 1024 * 1024 produces NaN and formatBytes(NaN) renders unexpected output. ModelStore.tsx (line 523–524) already guards this correctly.

🐛 Proposed fix
-                        {formatBytes(row?.size_of_model_in_mb * 1024 * 1024)}
+                        {row?.size_of_model_in_mb
+                          ? formatBytes(row.size_of_model_in_mb * 1024 * 1024)
+                          : '—'}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/ModelZoo/ModelGroups.tsx` at line 841, The code calls
formatBytes(row?.size_of_model_in_mb * 1024 * 1024) but row?.size_of_model_in_mb
is optional, so undefined * 1024 * 1024 yields NaN; update the rendering to
guard like ModelStore.tsx does: check row?.size_of_model_in_mb for defined (or
use nullish coalescing) before multiplying and call formatBytes only when a
valid number exists, otherwise render a fallback (e.g., '-' or empty string);
refer to the symbols formatBytes and row?.size_of_model_in_mb /
ModelGalleryEntry to locate where to change this.
src/renderer/components/Header.tsx (1)

14-169: ⚠️ Potential issue | 🔴 Critical

Critical: StatsBar references several undefined variables — will crash at runtime.

The refactored StatsBar removed the server/cs state and the Sparklines imports, but the JSX in the connected branch (lines 56–164) still references all of them:

  • server (lines 77, 81, 85, 89, 92, 95, 104) — undefined
  • cs (lines 146, 150, 157, 161) — undefined
  • Sparklines, SparklinesLine (lines 146–148, 157–159) — not imported
  • showGPU() (line 163) — undefined
  • formatBytes (lines 112, 114) — not imported

This will throw a ReferenceError whenever connection !== '', making the header unusable for connected users.

It looks like the intent was to strip out the detailed stats view entirely. The connected branch needs to be simplified to remove these references, or the necessary variables/imports need to be restored.

#!/bin/bash
# Verify that `server`, `cs`, `Sparklines`, `SparklinesLine`, `showGPU`, `formatBytes` are not defined/imported elsewhere in Header.tsx
rg -n '(const server|const cs|import.*Sparklines|function showGPU|import.*formatBytes)' --type-add 'ts:*.tsx' --type=ts -g '**/Header.tsx'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Header.tsx` around lines 14 - 169, StatsBar currently
references undefined symbols (server, cs, Sparklines, SparklinesLine, showGPU,
formatBytes) causing runtime crashes when connection !== ''. Fix by either
restoring the original state/imports or by simplifying the "connected" branch:
remove all uses of server, cs, showGPU and the Sparklines components and
formatBytes calls, and replace with a minimal safe UI (e.g., show connection
string and a Connected badge). Update the StatsBar function and imports
accordingly so no undefined identifiers remain (check function name StatsBar and
any helpers you remove or restore).
src/renderer/components/Welcome/Welcome.tsx (2)

149-153: ⚠️ Potential issue | 🔴 Critical

server is undefined — passed as prop to DownloadFirstModelModal.

server was removed from this component's scope but is still passed on line 152. This will pass undefined to the child component, which may cause errors or broken behavior depending on how DownloadFirstModelModal uses it.

#!/bin/bash
# Check what DownloadFirstModelModal does with the `server` prop
ast-grep --pattern $'function DownloadFirstModelModal($$$) {
  $$$
}'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Welcome/Welcome.tsx` around lines 149 - 153, The prop
server being passed to <DownloadFirstModelModal> is undefined because server was
removed from this component's scope; either remove the server prop from the JSX
or restore a valid server value from the correct source (e.g. props.server,
state, or context/selector) and pass that instead; inspect the
DownloadFirstModelModal component signature to determine whether it requires
server and if so wire it to the correct variable (or update
DownloadFirstModelModal to not require server) while keeping
modelDownloadModalOpen and setModelDownloadModalOpen unchanged.

108-108: ⚠️ Potential issue | 🔴 Critical

Critical: useEffect dependency array references undefined variables isLoading, server, isError.

The refactoring removed useServerStats() (and thus server, isLoading, isError), but the dependency array on line 108 still references them. This will cause a ReferenceError at runtime.

The dependency array should be updated to match the variables actually used inside the effect (e.g., hasInitiallyConnected).

Suggested fix
-  }, [isLoading, server, isError, hasInitiallyConnected]);
+  }, [hasInitiallyConnected]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Welcome/Welcome.tsx` at line 108, The effect in
Welcome (useEffect) references removed variables isLoading, server, and isError
in its dependency array causing a runtime ReferenceError; update the dependency
array for the useEffect inside the Welcome component to only include the actual
variables used inside the effect (for example keep hasInitiallyConnected and any
real state/props used there) and remove isLoading, server, and isError from the
array so it matches the current implementation (run lint/tests to confirm no
missing deps).
src/renderer/components/Shared/AnnouncementsModal.tsx (1)

39-203: ⚠️ Potential issue | 🔴 Critical

AnnouncementsModal's effect won't re-run when API_URL becomes available.

The effect calls API_URL() on line 41 but doesn't track its availability as a dependency. When AnnouncementsModal mounts, window.TransformerLab.API_URL is set asynchronously in App.tsx's own effect—meaning API_URL() initially returns null. The effect exits early at line 43 and hasChecked remains false. Since the dependency array only includes [hasChecked], there is no trigger for the effect to re-run when API_URL is later populated.

The previous implementation used useServerStats(), which provided reactive dependencies that would automatically re-trigger the effect upon connection. To fix this, either track connection availability as a reactive dependency or ensure AnnouncementsModal only mounts after the API URL is established.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Shared/AnnouncementsModal.tsx` around lines 39 - 203,
The effect in AnnouncementsModal uses API_URL() but doesn't depend on its value,
so it never re-runs when the API URL becomes available; update the useEffect
dependencies to include the connection flag (e.g., include API_URL() or a
derived isConnected value) or add a small effect to set a local isConnected
state and depend on that instead of only hasChecked; specifically, in the effect
that contains API_URL(), ensure the dependency array includes either API_URL()
or a stable boolean like isConnected so the effect (and the
checkForAnnouncements logic) re-executes when API_URL becomes populated
(alternatively reintroduce useServerStats() and include it in the deps).
🧹 Nitpick comments (4)
src/renderer/components/ModelZoo/ModelGroups.tsx (2)

295-299: handleSortClick is dead code — either use it or remove it.

All four column-header onClick handlers (lines 648–649, 675–677, 703–705, 731–733) contain their own inline lambdas rather than calling handleSortClick. The function is never invoked.

♻️ Option A — remove the dead function
-  const handleSortClick = (column: string) => {
-    const isAsc = orderBy === column && order === 'asc';
-    setOrder(isAsc ? 'desc' : 'asc');
-    setOrderBy(column);
-  };
♻️ Option B — use it consistently across all headers
-                        onClick={() => {
-                          setOrder(order === 'asc' ? 'desc' : 'asc');
-                          setOrderBy('name');
-                        }}
+                        onClick={() => handleSortClick('name')}

(apply the same substitution for license, architecture, and size_of_model_in_mb headers)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/ModelZoo/ModelGroups.tsx` around lines 295 - 299,
handleSortClick is defined but never used; replace the inline onClick lambdas
for the four column headers with calls to handleSortClick so the shared sorting
logic is used. Specifically, in the header components that currently have inline
lambdas for 'name', 'license', 'architecture', and 'size_of_model_in_mb' onClick
handlers, call handleSortClick('name') / handleSortClick('license') /
handleSortClick('architecture') / handleSortClick('size_of_model_in_mb')
respectively (preserving any existing event.preventDefault behavior if needed)
so setOrder/setOrderBy flow goes through the single function; keep
handleSortClick as-is and remove duplicate sorting logic from those inline
handlers.

284-286: Remove unused licenseOptions variable or implement a License filter UI to match the Architecture filter pattern.

licenseOptions is computed at lines 284-286 but never referenced. The getArchitectureOptions() is used identically and powers the Architecture filter UI (line 618), but there is no License filter implementation. Either add a License <Select> to the showFilters block (consistent with ModelStore.tsx) or remove the dead variable and its getLicenseOptions() helper.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/ModelZoo/ModelGroups.tsx` around lines 284 - 286,
Remove the unused licenseOptions or implement the missing License filter: either
delete the licenseOptions declaration and the getLicenseOptions helper (and any
unused imports) to eliminate dead code, or add a License <Select> in the same
showFilters block that mirrors the Architecture filter implementation (use
selectedGroup.models, getLicenseOptions(selectedGroup.models) for options, track
the selected license in the same state used by architecture filtering, and hook
it into the existing model filtering logic in ModelStore.tsx). Locate symbols:
licenseOptions, selectedGroup, getLicenseOptions, getArchitectureOptions, and
the showFilters block to apply the change consistently.
src/renderer/components/Compute/Resources.tsx (1)

113-113: Remove debug console.log statements before merging.

Lines 113 and 187 contain debug logging (console.log('Clusters data:', clustersData) and console.log(providers)) that should be removed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Compute/Resources.tsx` at line 113, Remove the debug
console.log statements left in the Resources component: delete the
console.log('Clusters data:', clustersData) and console.log(providers) calls so
no debug output remains; locate them inside the Resources React component where
clustersData and providers are referenced and remove those lines (or replace
with proper logger calls if needed).
src/renderer/components/Header.tsx (1)

255-282: Dead code: getBackgroundColor and PercentWithColoredBackgroundMeter appear unused.

These helper functions were likely used by the old StatsBar implementation. With the stats display removed, they can be cleaned up.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Header.tsx` around lines 255 - 282, Remove the dead
helper components getBackgroundColor and PercentWithColoredBackgroundMeter from
the file: these functions are unused since the old StatsBar was removed, so
delete the getBackgroundColor function and the PercentWithColoredBackgroundMeter
component (including its related prop usage) and any imports only used by them
to avoid unused symbol warnings; search for "getBackgroundColor" and
"PercentWithColoredBackgroundMeter" to ensure no remaining references before
committing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/renderer/components/Compute/LocalMachineSummary.tsx`:
- Around line 131-133: The Windows icon check in LocalMachineSummary.tsx uses a
case-sensitive includes('microsoft') and thus misses typical platform strings
like 'Microsoft'; update the check on server.platform used for rendering
<FaWindows /> to normalize case (e.g., call toLowerCase() or similar) before
testing for 'microsoft' — mirror the existing pattern used for 'mac' and 'linux'
so server.platform?.toLowerCase().includes('microsoft') is used alongside the
FaWindows check.

In `@src/renderer/lib/api-client/hooks.ts`:
- Around line 117-119: In useServerStats(), the URL construction redundantly
calls API_URL() twice; change the url assignment to use the already-captured
api_url variable (so url is built from api_url + 'server/info' when api_url is
non-null) and remove the extra API_URL() invocation to match the pattern used in
useModelStatus.

---

Outside diff comments:
In `@src/renderer/components/Header.tsx`:
- Around line 14-169: StatsBar currently references undefined symbols (server,
cs, Sparklines, SparklinesLine, showGPU, formatBytes) causing runtime crashes
when connection !== ''. Fix by either restoring the original state/imports or by
simplifying the "connected" branch: remove all uses of server, cs, showGPU and
the Sparklines components and formatBytes calls, and replace with a minimal safe
UI (e.g., show connection string and a Connected badge). Update the StatsBar
function and imports accordingly so no undefined identifiers remain (check
function name StatsBar and any helpers you remove or restore).

In `@src/renderer/components/ModelZoo/ModelGroups.tsx`:
- Around line 268-282: The helper functions getLicenseOptions and
getArchitectureOptions should not use any[]; replace the parameter type with a
strict model shape such as an interface or a Pick of the existing
ModelGalleryEntry (e.g., Pick<ModelGalleryEntry, 'license' | 'architecture'>[])
and update the loop variable types accordingly (replace m: any with m:
Pick<ModelGalleryEntry, 'license' | 'architecture'>). Ensure both function
signatures and the internal usage reference that type so TypeScript enforces
presence/optional of license/architecture fields.
- Line 841: The code calls formatBytes(row?.size_of_model_in_mb * 1024 * 1024)
but row?.size_of_model_in_mb is optional, so undefined * 1024 * 1024 yields NaN;
update the rendering to guard like ModelStore.tsx does: check
row?.size_of_model_in_mb for defined (or use nullish coalescing) before
multiplying and call formatBytes only when a valid number exists, otherwise
render a fallback (e.g., '-' or empty string); refer to the symbols formatBytes
and row?.size_of_model_in_mb / ModelGalleryEntry to locate where to change this.

In `@src/renderer/components/Shared/AnnouncementsModal.tsx`:
- Around line 39-203: The effect in AnnouncementsModal uses API_URL() but
doesn't depend on its value, so it never re-runs when the API URL becomes
available; update the useEffect dependencies to include the connection flag
(e.g., include API_URL() or a derived isConnected value) or add a small effect
to set a local isConnected state and depend on that instead of only hasChecked;
specifically, in the effect that contains API_URL(), ensure the dependency array
includes either API_URL() or a stable boolean like isConnected so the effect
(and the checkForAnnouncements logic) re-executes when API_URL becomes populated
(alternatively reintroduce useServerStats() and include it in the deps).

In `@src/renderer/components/Welcome/Welcome.tsx`:
- Around line 149-153: The prop server being passed to <DownloadFirstModelModal>
is undefined because server was removed from this component's scope; either
remove the server prop from the JSX or restore a valid server value from the
correct source (e.g. props.server, state, or context/selector) and pass that
instead; inspect the DownloadFirstModelModal component signature to determine
whether it requires server and if so wire it to the correct variable (or update
DownloadFirstModelModal to not require server) while keeping
modelDownloadModalOpen and setModelDownloadModalOpen unchanged.
- Line 108: The effect in Welcome (useEffect) references removed variables
isLoading, server, and isError in its dependency array causing a runtime
ReferenceError; update the dependency array for the useEffect inside the Welcome
component to only include the actual variables used inside the effect (for
example keep hasInitiallyConnected and any real state/props used there) and
remove isLoading, server, and isError from the array so it matches the current
implementation (run lint/tests to confirm no missing deps).

---

Nitpick comments:
In `@src/renderer/components/Compute/Resources.tsx`:
- Line 113: Remove the debug console.log statements left in the Resources
component: delete the console.log('Clusters data:', clustersData) and
console.log(providers) calls so no debug output remains; locate them inside the
Resources React component where clustersData and providers are referenced and
remove those lines (or replace with proper logger calls if needed).

In `@src/renderer/components/Header.tsx`:
- Around line 255-282: Remove the dead helper components getBackgroundColor and
PercentWithColoredBackgroundMeter from the file: these functions are unused
since the old StatsBar was removed, so delete the getBackgroundColor function
and the PercentWithColoredBackgroundMeter component (including its related prop
usage) and any imports only used by them to avoid unused symbol warnings; search
for "getBackgroundColor" and "PercentWithColoredBackgroundMeter" to ensure no
remaining references before committing.

In `@src/renderer/components/ModelZoo/ModelGroups.tsx`:
- Around line 295-299: handleSortClick is defined but never used; replace the
inline onClick lambdas for the four column headers with calls to handleSortClick
so the shared sorting logic is used. Specifically, in the header components that
currently have inline lambdas for 'name', 'license', 'architecture', and
'size_of_model_in_mb' onClick handlers, call handleSortClick('name') /
handleSortClick('license') / handleSortClick('architecture') /
handleSortClick('size_of_model_in_mb') respectively (preserving any existing
event.preventDefault behavior if needed) so setOrder/setOrderBy flow goes
through the single function; keep handleSortClick as-is and remove duplicate
sorting logic from those inline handlers.
- Around line 284-286: Remove the unused licenseOptions or implement the missing
License filter: either delete the licenseOptions declaration and the
getLicenseOptions helper (and any unused imports) to eliminate dead code, or add
a License <Select> in the same showFilters block that mirrors the Architecture
filter implementation (use selectedGroup.models,
getLicenseOptions(selectedGroup.models) for options, track the selected license
in the same state used by architecture filtering, and hook it into the existing
model filtering logic in ModelStore.tsx). Locate symbols: licenseOptions,
selectedGroup, getLicenseOptions, getArchitectureOptions, and the showFilters
block to apply the change consistently.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5cf43db and e55ac23.

📒 Files selected for processing (18)
  • api/transformerlab/routers/serverinfo.py
  • src/renderer/components/Compute/LocalMachineSummary.tsx
  • src/renderer/components/Compute/Resources.tsx
  • src/renderer/components/Experiment/Diffusion/Diffusion.tsx
  • src/renderer/components/Experiment/Diffusion/History.tsx
  • src/renderer/components/Experiment/Diffusion/HistoryImageViewModal.tsx
  • src/renderer/components/Experiment/Diffusion/Inpainting.tsx
  • src/renderer/components/Experiment/Foundation/RunModelButton.tsx
  • src/renderer/components/Header.tsx
  • src/renderer/components/MainAppPanel.tsx
  • src/renderer/components/ModelZoo/ModelGroups.tsx
  • src/renderer/components/ModelZoo/ModelStore.tsx
  • src/renderer/components/ModelZoo/ModelVramSidebar.tsx
  • src/renderer/components/Shared/AnnouncementsModal.tsx
  • src/renderer/components/Welcome/Welcome.tsx
  • src/renderer/lib/api-client/functions.ts
  • src/renderer/lib/api-client/hooks.ts
  • src/renderer/lib/authContext.ts
💤 Files with no reviewable changes (10)
  • src/renderer/components/MainAppPanel.tsx
  • src/renderer/lib/api-client/functions.ts
  • src/renderer/components/Experiment/Diffusion/Inpainting.tsx
  • src/renderer/lib/authContext.ts
  • src/renderer/components/Experiment/Diffusion/History.tsx
  • src/renderer/components/Experiment/Diffusion/Diffusion.tsx
  • src/renderer/components/Experiment/Foundation/RunModelButton.tsx
  • src/renderer/components/Experiment/Diffusion/HistoryImageViewModal.tsx
  • api/transformerlab/routers/serverinfo.py
  • src/renderer/components/ModelZoo/ModelVramSidebar.tsx

Comment on lines 117 to +119
export function useServerStats() {
const api_url = API_URL();
const isLocalMode =
typeof window !== 'undefined' && window?.platform?.multiuser !== true;
const url: string | null =
api_url && isLocalMode ? API_URL() + 'server/info' : null;
const url: string | null = api_url ? API_URL() + 'server/info' : null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Redundant API_URL() call — use api_url instead.

Line 118 already captures API_URL() into api_url, but line 119 calls API_URL() again. This is inconsistent with useModelStatus (line 78) which uses api_url for URL construction.

Suggested fix
 export function useServerStats() {
   const api_url = API_URL();
-  const url: string | null = api_url ? API_URL() + 'server/info' : null;
+  const url: string | null = api_url ? api_url + 'server/info' : null;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/lib/api-client/hooks.ts` around lines 117 - 119, In
useServerStats(), the URL construction redundantly calls API_URL() twice; change
the url assignment to use the already-captured api_url variable (so url is built
from api_url + 'server/info' when api_url is non-null) and remove the extra
API_URL() invocation to match the pattern used in useModelStatus.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/renderer/components/Compute/LocalMachineSummary.tsx (1)

26-27: Define an explicit interface for the server object returned by useServerStats.

Every field accessed in this component (gpu, cpu_percent, cpu_count, device, device_type, memory, disk, platform, os, name, python_version) is reached through speculative optional chaining, suggesting the server object type is either loosely typed or typed as any. Per coding guidelines, API response shapes should be described with proper interfaces.

♻️ Suggested interface skeleton
+interface GpuInfo {
+  name: string;
+}
+
+interface DiskInfo {
+  percent: number;
+  total: number;
+  used: number;
+  free: number;
+}
+
+interface MemoryInfo {
+  total: number;
+  available: number;
+  used: number;
+}
+
+interface ServerStats {
+  os?: string;
+  name?: string;
+  platform?: string;
+  cpu_percent?: number;
+  cpu_count?: number;
+  device?: string;
+  device_type?: string;
+  gpu?: GpuInfo[];
+  memory?: MemoryInfo;
+  disk?: DiskInfo;
+  python_version?: string;
+}

As per coding guidelines: "Avoid using any type in TypeScript; define interfaces for all props and API responses to ensure type safety."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Compute/LocalMachineSummary.tsx` around lines 26 -
27, Define a TypeScript interface describing the server shape used by
LocalMachineSummary (include fields: gpu, cpu_percent, cpu_count, device,
device_type, memory, disk, platform, os, name, python_version, and mark optional
where API may omit them) and update the return type of useServerStats to use
that interface (e.g., useServerStats(): { server: ServerInfo | null; isLoading:
boolean; isError: boolean }). Then update LocalMachineSummary's typing to
reference this interface (replace any loose/any types) and remove speculative
typing by using the typed server object with proper null checks or optional
chaining as appropriate. Ensure the interface is exported where needed so the
hook and component share the same type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/renderer/components/Compute/LocalMachineSummary.tsx`:
- Around line 26-27: Define a TypeScript interface describing the server shape
used by LocalMachineSummary (include fields: gpu, cpu_percent, cpu_count,
device, device_type, memory, disk, platform, os, name, python_version, and mark
optional where API may omit them) and update the return type of useServerStats
to use that interface (e.g., useServerStats(): { server: ServerInfo | null;
isLoading: boolean; isError: boolean }). Then update LocalMachineSummary's
typing to reference this interface (replace any loose/any types) and remove
speculative typing by using the typed server object with proper null checks or
optional chaining as appropriate. Ensure the interface is exported where needed
so the hook and component share the same type.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90ae0b5 and 3219ef8.

📒 Files selected for processing (1)
  • src/renderer/components/Compute/LocalMachineSummary.tsx

@sentry
Copy link

sentry bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant