Skip to content

Toast fix#1193

Merged
duckduckhero merged 2 commits intomainfrom
toast-fix
Jul 22, 2025
Merged

Toast fix#1193
duckduckhero merged 2 commits intomainfrom
toast-fix

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

📝 Walkthrough

Walkthrough

The changes replace the "list_supported_models" command and its associated permissions with a new "list_downloaded_model" command in the local-llm plugin. Application logic for displaying model download notifications is updated to use a new React Query hook that checks for downloaded models. Permission files, schemas, and documentation are updated accordingly.

Changes

File(s) Change Summary
apps/desktop/src/components/toast/model-download.tsx Added React Query hook listDownloadedModels for fetching downloaded LLM models; updated logic for showing download notification.
apps/desktop/src/components/welcome-modal/index.tsx Updated handleModelSelected to set session storage flag when a model is selected.
plugins/local-llm/build.rs Replaced "list_supported_models" with "list_downloaded_model" in the COMMANDS array.
plugins/local-llm/permissions/autogenerated/commands/list_downloaded_model.toml Added new permission config for "list_downloaded_model" command.
plugins/local-llm/permissions/autogenerated/commands/list_supported_models.toml Removed permission config for "list_supported_models" command.
plugins/local-llm/permissions/autogenerated/reference.md Updated permission identifiers/descriptions from "supported_models" to "downloaded_model".
plugins/local-llm/permissions/default.toml Changed default permission from "allow-list-supported-models" to "allow-list-downloaded-model".
plugins/local-llm/permissions/schemas/schema.json Updated schema to reference "list_downloaded_model" and related permission identifiers.

Sequence Diagram(s)

sequenceDiagram
    participant UI as ModelDownloadNotification (React)
    participant Query as React Query Hook
    participant LocalLLM as localLlmCommands

    UI->>Query: useQuery("listDownloadedModels")
    Query->>LocalLLM: localLlmCommands.listDownloadedModel()
    LocalLLM-->>Query: [list of downloaded models]
    Query-->>UI: data
    UI->>UI: If data.length === 0, show download notification
Loading

Estimated code review effort

3 (~45 minutes)

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 0

🔭 Outside diff range comments (1)
apps/desktop/src/components/toast/model-download.tsx (1)

144-144: Add missing dependency to useEffect hook.

The useEffect hook uses listDownloadedModels.data on line 88 but doesn't include it in the dependency array. This could cause stale closures and incorrect behavior.

-  }, [checkForModelDownload.data, sttModelDownloading.data, llmModelDownloading.data, isDismissed]);
+  }, [checkForModelDownload.data, sttModelDownloading.data, llmModelDownloading.data, isDismissed, listDownloadedModels.data]);
🧹 Nitpick comments (1)
apps/desktop/src/components/welcome-modal/index.tsx (1)

82-82: LGTM! Session storage flag correctly placed for toast dismissal.

The timing is appropriate - setting the flag after model mutation but before modal closure ensures the toast behavior is properly controlled.

Consider extracting the session storage key to a constant to avoid magic strings:

+const MODEL_DOWNLOAD_TOAST_DISMISSED_KEY = "model-download-toast-dismissed";
+
 const handleModelSelected = (model: SupportedModel) => {
   selectSTTModel.mutate(model);

-  sessionStorage.setItem("model-download-toast-dismissed", "true");
+  sessionStorage.setItem(MODEL_DOWNLOAD_TOAST_DISMISSED_KEY, "true");

   onClose();
 };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b21411 and d418a65.

📒 Files selected for processing (8)
  • apps/desktop/src/components/toast/model-download.tsx (2 hunks)
  • apps/desktop/src/components/welcome-modal/index.tsx (1 hunks)
  • plugins/local-llm/build.rs (1 hunks)
  • plugins/local-llm/permissions/autogenerated/commands/list_downloaded_model.toml (1 hunks)
  • plugins/local-llm/permissions/autogenerated/commands/list_supported_models.toml (0 hunks)
  • plugins/local-llm/permissions/autogenerated/reference.md (2 hunks)
  • plugins/local-llm/permissions/default.toml (1 hunks)
  • plugins/local-llm/permissions/schemas/schema.json (2 hunks)
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • plugins/local-llm/build.rs
  • apps/desktop/src/components/welcome-modal/index.tsx
  • apps/desktop/src/components/toast/model-download.tsx
💤 Files with no reviewable changes (1)
  • plugins/local-llm/permissions/autogenerated/commands/list_supported_models.toml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • plugins/local-llm/build.rs
  • apps/desktop/src/components/welcome-modal/index.tsx
  • apps/desktop/src/components/toast/model-download.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (windows, windows-latest)
  • GitHub Check: ci (macos, macos-latest)
🔇 Additional comments (9)
plugins/local-llm/build.rs (1)

12-12: LGTM! Command replacement is correctly implemented.

The addition of "list_downloaded_model" to the COMMANDS array aligns with the broader refactoring to replace the old list_supported_models functionality.

plugins/local-llm/permissions/default.toml (1)

14-14: LGTM! Permission update maintains consistency.

The permission string correctly reflects the new command name, maintaining the established naming convention.

plugins/local-llm/permissions/autogenerated/commands/list_downloaded_model.toml (1)

1-14: LGTM! Well-structured permission file follows established patterns.

The permission definitions correctly implement both allow and deny variants for the new list_downloaded_model command, following the standard format and including appropriate auto-generation warnings.

plugins/local-llm/permissions/autogenerated/reference.md (2)

17-17: LGTM! Default permission list correctly updated.

The documentation properly reflects the new permission in the default set.


187-206: LGTM! Permission table entries comprehensively updated.

All references to the old list-supported-models permission have been correctly replaced with list-downloaded-model, maintaining consistency in both identifiers and descriptions.

apps/desktop/src/components/toast/model-download.tsx (2)

44-50: LGTM! Clean implementation of the new query hook.

The new listDownloadedModels query correctly calls the updated command and uses a 3-second polling interval which is appropriate for this use case.


88-88: Logic change looks correct.

Checking if the downloaded models array is empty is a more direct approach than the previous logic and aligns well with the new command functionality.

plugins/local-llm/permissions/schemas/schema.json (2)

370-379: Permission identifiers correctly updated.

The permission identifiers have been properly renamed from list-supported-models to list-downloaded-model for both allow and deny cases, with matching descriptions and markdown documentation.


442-445: Default permission documentation properly updated.

The default permission set description correctly includes the new allow-list-downloaded-model permission, maintaining consistency with the command rename.

@duckduckhero duckduckhero merged commit c412cd5 into main Jul 22, 2025
7 checks passed
@ComputelessComputer ComputelessComputer deleted the toast-fix branch December 14, 2025 15:21
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