Skip to content

Conversation

@urmauur
Copy link
Member

@urmauur urmauur commented Jul 26, 2025

Describe Your Changes

This pull request refactors the useLlamacppDevices hook to simplify device activation management by incorporating the activation status directly into the devices array. It removes the separate activatedDevices state and updates related components and tests accordingly.

Refactor of device activation management:

  • web-app/src/hooks/useLlamacppDevices.ts: Removed the activatedDevices state and added an activated property to each device in the devices array. Updated the fetchDevices and toggleDevice methods to handle activation status directly within the devices array. [1] [2] [3]

  • web-app/src/services/hardware.ts: Updated the DeviceList interface to include an activated property and ensured that devices fetched from the llamacpp extension include their activation status. [1] [2]

Updates to tests:

Component updates:

Other updates:

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Refactor useLlamacppDevices to manage device activation within devices array, updating components and tests accordingly.

  • Behavior:
    • Refactor useLlamacppDevices in useLlamacppDevices.ts to include activated status in devices array, removing activatedDevices state.
    • Update fetchDevices and toggleDevice to manage activation within devices.
    • Modify DeviceList in hardware.ts to include activated property.
  • Tests:
    • Update useLlamacppDevices.test.ts to validate activated property in devices and remove activatedDevices references.
  • Components:
    • Update hardware.tsx and system-monitor.tsx to use activated property for UI logic.
    • Adjust llamacpp device activation reset logic in $providerName.tsx to use fetchDevices.

This description was created by Ellipsis for ed8442e. You can customize this summary. It will automatically update as commits are pushed.

@urmauur urmauur added this to the v0.6.6 milestone Jul 26, 2025
@urmauur urmauur self-assigned this Jul 26, 2025
@urmauur urmauur added this to Jan Jul 26, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to ed8442e in 1 minute and 3 seconds. Click for details.
  • Reviewed 417 lines of code in 6 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/hooks/__tests__/useLlamacppDevices.test.ts:80
  • Draft comment:
    The 'should set devices directly' test passes a device object without an explicit 'activated' property. Since the new type requires 'activated: boolean', consider updating the test fixture to include it (e.g. activated: false) for consistency.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. web-app/src/hooks/useLlamacppDevices.ts:95
  • Draft comment:
    In toggleDevice, updateSettings is awaited without error handling. Consider wrapping the updateSettings call in a try/catch block to handle potential provider update failures gracefully.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. web-app/src/routes/settings/hardware.tsx:87
  • Draft comment:
    Removal of manual activatedDevices initialization simplifies the component. Ensure that fetchDevices reliably initializes the activation state for all devices as intended.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. web-app/src/routes/settings/providers/$providerName.tsx:369
  • Draft comment:
    Replacing setActivatedDevices with a call to fetchDevices for resetting activation state is appropriate. If rapid backend changes occur, consider debouncing the fetchDevices call to avoid excessive updates.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. web-app/src/services/hardware.ts:10
  • Draft comment:
    The DeviceList interface now includes an 'activated' property. Ensure that the llamacpp extension’s getDevices() either supplies this property or that the hook correctly assigns it during mapping.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_Xj4vomFYT1QbHBes

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@urmauur urmauur moved this to Needs Review in Jan Jul 27, 2025
Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

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

LGTM and works great!

@urmauur urmauur merged commit 54d44ce into release/v0.6.6 Jul 27, 2025
20 of 21 checks passed
@urmauur urmauur deleted the fix/simplify-gpu-list branch July 27, 2025 07:36
@github-project-automation github-project-automation bot moved this from Needs Review to QA in Jan Jul 27, 2025
@urmauur urmauur moved this from QA to Done in Jan Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

bug: GPU settings display incorrectly on first launch - toggled ON in settings but shows OFF in GUI

3 participants