Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disabled remote model and show prompt users to use on-device models when offline mode #4229

Closed
wants to merge 2 commits into from

Conversation

urmauur
Copy link
Member

@urmauur urmauur commented Dec 5, 2024

Describe Your Changes

The changes made in the code are as follows:

  1. Test Modifications (index.test.ts):

    • Added a test case to check if useOnlineStatus is defined and exported correctly from the components.
  2. Module Export Update (index.ts):

    • Added useOnlineStatus to the list of exported hooks from the module.
  3. Component Update (ModelDropdown/index.tsx):

    • Imported the useOnlineStatus hook from the @janhq/joi library.
    • Imported the WifiOff icon from the lucide-react library.
    • Utilized the useOnlineStatus hook to check the online status (isOnline) within the ModelDropdown component.
    • Adjusted CSS classes for list items to also disable them if the application is offline unless they are local engines.
    • Added a new UI element that displays at the bottom of the list when the user is offline and the searchFilter is set to 'remote'. It includes the WifiOff icon and a message informing the user that they are offline and should use on-device models.

Screenshots

Screen.Recording.2024-12-05.at.13.11.16.mov
Screenshot 2024-12-05 at 13 26 52

CleanShot 2024-12-05 at 11 05 22
CleanShot 2024-12-05 at 11 04 40
CleanShot 2024-12-05 at 11 04 27

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

@urmauur urmauur added the type: feature request A new feature label Dec 5, 2024
@urmauur urmauur added this to the v0.5.12 milestone Dec 5, 2024
@urmauur urmauur requested a review from louis-jan December 5, 2024 04:18
@urmauur urmauur self-assigned this Dec 5, 2024
Copy link
Contributor

github-actions bot commented Dec 5, 2024

Barecheck - Code coverage report

Total: 69.38%

Your code coverage diff: 0.08% ▴

Uncovered files and lines
FileLines
web/containers/ModelDropdown/index.tsx106, 117, 127-128, 131, 133-134, 136-137, 139-142, 144, 152, 169-171, 173, 175, 194, 198, 203, 210, 213-214, 249-251, 255, 279-281, 283, 287, 290-295, 302-303, 314, 336, 352, 373, 382, 388, 396-397, 400-405, 408, 411, 463-464, 466, 492, 500, 502, 527, 532-533, 535, 539-541, 543-544, 546, 557, 561-563, 591, 599, 601

@louis-jan
Copy link
Contributor

To investigate more

@urmauur urmauur force-pushed the feat/disable-remote-model branch from dcc8752 to 88b107c Compare December 6, 2024 02:20
@urmauur
Copy link
Member Author

urmauur commented Dec 9, 2024

closed PR since ticket change

@urmauur urmauur closed this Dec 9, 2024
@imtuyethan imtuyethan removed this from the v0.5.12 milestone Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enhancement: Better error handing for remote models when there's no internet connection
3 participants