Skip to content

add toggle for useLocalLLM#122

Merged
raphael-frank merged 2 commits into
mainfrom
feature/116-local-llm-toogle
Jul 14, 2026
Merged

add toggle for useLocalLLM#122
raphael-frank merged 2 commits into
mainfrom
feature/116-local-llm-toogle

Conversation

@raphael-frank

@raphael-frank raphael-frank commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

We added support for local llm usage in the API which is controlled by a boolean parameter in the generate report endpoints. This PR adds a toggle in the Web Client so we can control whether we want to use the AI API or a local LLM for report generation.

Closes #116

Summary by CodeRabbit

  • New Features

    • Added a “Use local LLM” option when generating reports.
    • Added a switch control with small and default size options.
    • The option is disabled while report generation is in progress.
  • Bug Fixes

    • Report generation now correctly applies the selected local processing preference.

@raphael-frank raphael-frank self-assigned this Jul 8, 2026
@raphael-frank raphael-frank added the client Issue regarding the client frontend label Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Radix-based switch component and integrates a “Use local LLM” toggle into report generation. The toggle state flows from HelperPage through useReportViewModel into member or team report API mutations as a uselocal request field.

Changes

Local LLM report generation

Layer / File(s) Summary
Switch component
web-client/src/components/ui/switch.tsx
Adds a typed Radix switch with size variants, state styling, disabled styling, and a translated thumb.
Report mutation payloads
web-client/src/features/helper/api/queries.ts
Member and team report mutations accept an optional boolean and send { uselocal: useLocal } while retaining report-list invalidation.
Helper page toggle wiring
web-client/src/features/helper/model/useReportViewModel.ts, web-client/src/features/helper/pages/HelperPage.tsx
The view model forwards the local-generation option, and the page renders a labeled switch that is disabled during generation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HelperPage
  participant useReportViewModel
  participant ReportMutation
  participant ReportEndpoint
  HelperPage->>useReportViewModel: generate(useLocalLlm)
  useReportViewModel->>ReportMutation: mutate(useLocal)
  ReportMutation->>ReportEndpoint: POST { uselocal: useLocal }
  ReportEndpoint-->>ReportMutation: report generation result
Loading

Possibly related PRs

Suggested labels: client

Suggested reviewers: fadygergesrezk

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a useLocalLLM toggle.
Linked Issues check ✅ Passed The PR adds a Web Client toggle and wires it through report generation to control local LLM vs AI API as requested in #116.
Out of Scope Changes check ✅ Passed The new Switch component and API/viewmodel updates directly support the toggle and are not unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/116-local-llm-toogle

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

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

@f-s-h
f-s-h requested review from f-s-h and removed request for FadyGergesRezk July 14, 2026 15:55

@f-s-h f-s-h left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

…-toogle

# Conflicts:
#	web-client/src/features/helper/api/queries.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web-client/src/features/helper/pages/HelperPage.tsx (1)

61-66: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove redundant state update.

React batches state updates within event handlers. Calling setGenerated(false) synchronously before setGenerated(true) in the same execution block has no effect, as the intermediate false state will never be rendered.

♻️ Proposed refactor
   const onGenerate = () => {
-    setGenerated(false)
     generate(useLocalLlm)
     // The result is async (the POST returns 202 with no body); confirm we kicked it off.
     setGenerated(true)
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web-client/src/features/helper/pages/HelperPage.tsx` around lines 61 - 66,
Remove the redundant setGenerated(false) call from onGenerate and retain the
final setGenerated(true) update after generate(useLocalLlm), preserving the
existing async generation flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@web-client/src/features/helper/pages/HelperPage.tsx`:
- Around line 61-66: Remove the redundant setGenerated(false) call from
onGenerate and retain the final setGenerated(true) update after
generate(useLocalLlm), preserving the existing async generation flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f08f06e5-0194-4452-9807-485f4b0c33e3

📥 Commits

Reviewing files that changed from the base of the PR and between 174a28e and 234bc33.

📒 Files selected for processing (4)
  • web-client/src/components/ui/switch.tsx
  • web-client/src/features/helper/api/queries.ts
  • web-client/src/features/helper/model/useReportViewModel.ts
  • web-client/src/features/helper/pages/HelperPage.tsx

@raphael-frank
raphael-frank merged commit 589f5f3 into main Jul 14, 2026
18 checks passed
@raphael-frank
raphael-frank deleted the feature/116-local-llm-toogle branch July 14, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Issue regarding the client frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: UseLocalLLM Toogle in Web Client

2 participants