Skip to content

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

📝 Walkthrough

Walkthrough

The changes expand the list of available speech-to-text models with new quantized variants, enhance the frontend's synchronization with backend model selection for both STT and LLM models, and introduce polling to keep STT model download statuses updated. Localization files are updated with new source code line references, reflecting code shifts.

Changes

Files Change Summary
apps/desktop/src/components/settings/views/ai.tsx Added new STT model variants; implemented React Query hooks for syncing current model state and polling download status; updated UI logic for model selection and backend synchronization.
apps/desktop/src/locales/en/messages.po
apps/desktop/src/locales/ko/messages.po
Updated source code reference line numbers for translation entries to match new positions in the source file.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (LocalAI)
    participant Backend

    User->>UI (LocalAI): Selects STT or LLM model
    alt STT model selected and downloaded
        UI (LocalAI)->>Backend: setCurrentSTTModel(selectedModel)
    end
    alt LLM model selected and custom LLM disabled
        UI (LocalAI)->>Backend: setCurrentLLMModel(selectedModel)
        UI (LocalAI)->>Backend: disableCustomLLM()
    end
    loop Every 3 seconds
        UI (LocalAI)->>Backend: fetchSTTModelDownloadStatus()
        Backend-->>UI (LocalAI): Returns download status for all STT models
        UI (LocalAI)->>UI (LocalAI): Update local STT model status
    end
    UI (LocalAI)->>Backend: fetchCurrentLLMModel()
    Backend-->>UI (LocalAI): Returns current LLM model
    UI (LocalAI)->>Backend: fetchCurrentSTTModel()
    Backend-->>UI (LocalAI): Returns current STT model
    UI (LocalAI)->>UI (LocalAI): Sync local state with backend
Loading

Estimated code review effort

3 (90–240 minutes)

✨ 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

@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

🧹 Nitpick comments (1)
apps/desktop/src/components/settings/views/ai.tsx (1)

418-441: Consider deriving model keys dynamically to improve maintainability

The model keys are hard-coded in the status check, which could lead to maintenance issues if models are added or removed.

-    queryFn: async () => {
-      const statusChecks = await Promise.all([
-        localSttCommands.isModelDownloaded("QuantizedTiny"),
-        localSttCommands.isModelDownloaded("QuantizedTinyEn"),
-        localSttCommands.isModelDownloaded("QuantizedBase"),
-        localSttCommands.isModelDownloaded("QuantizedBaseEn"),
-        localSttCommands.isModelDownloaded("QuantizedSmall"),
-        localSttCommands.isModelDownloaded("QuantizedSmallEn"),
-        localSttCommands.isModelDownloaded("QuantizedLargeTurbo"),
-      ]);
-      return {
-        "QuantizedTiny": statusChecks[0],
-        "QuantizedTinyEn": statusChecks[1],
-        "QuantizedBase": statusChecks[2],
-        "QuantizedBaseEn": statusChecks[3],
-        "QuantizedSmall": statusChecks[4],
-        "QuantizedSmallEn": statusChecks[5],
-        "QuantizedLargeTurbo": statusChecks[6],
-      } as Record<string, boolean>;
+    queryFn: async () => {
+      const statusPromises = sttModels.map(model => 
+        localSttCommands.isModelDownloaded(model.key as any)
+      );
+      const statusChecks = await Promise.all(statusPromises);
+      
+      return sttModels.reduce((acc, model, index) => {
+        acc[model.key] = statusChecks[index];
+        return acc;
+      }, {} as Record<string, boolean>);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b4364c1 and 4239a83.

📒 Files selected for processing (3)
  • apps/desktop/src/components/settings/views/ai.tsx (5 hunks)
  • apps/desktop/src/locales/en/messages.po (11 hunks)
  • apps/desktop/src/locales/ko/messages.po (11 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

🧬 Code Graph Analysis (1)
apps/desktop/src/components/settings/views/ai.tsx (2)
plugins/local-llm/js/bindings.gen.ts (1)
  • SupportedModel (55-55)
plugins/local-stt/js/bindings.gen.ts (1)
  • SupportedModel (69-69)
⏰ 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 (1)
apps/desktop/src/locales/en/messages.po (1)

349-1327: LGTM!

The line reference updates correctly reflect the shifts in the source file positions.

onClick={() => {
if (model.downloaded) {
setSelectedSTTModel(model.key);
localSttCommands.setCurrentModel(model.key as any);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve type safety by avoiding type assertions

The use of as any and as SupportedModel type assertions could hide type mismatches at compile time.

Consider updating the model type definitions to properly type the model keys, eliminating the need for type assertions. This would provide better compile-time type safety.

Also applies to: 627-627

🤖 Prompt for AI Agents
In apps/desktop/src/components/settings/views/ai.tsx at lines 489 and 627, the
code uses 'as any' and 'as SupportedModel' type assertions on model keys, which
reduces type safety. To fix this, update the type definitions for the model keys
so they correctly reflect the expected types without needing assertions. Adjust
the model and localSttCommands types to align, ensuring the model.key is typed
properly and can be passed directly to setCurrentModel without casting.

@yujonglee
Copy link
Contributor

I would suggest makes things more type safe, but we'll rewrite setting/ai tab anyway :)

@yujonglee yujonglee merged commit 5d332ec into main Jul 21, 2025
7 checks passed
@yujonglee yujonglee deleted the model-select-hotfix branch July 21, 2025 16:04
@coderabbitai coderabbitai bot mentioned this pull request Sep 7, 2025
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.

3 participants