add toggle for useLocalLLM#122
Conversation
📝 WalkthroughWalkthroughAdds a Radix-based switch component and integrates a “Use local LLM” toggle into report generation. The toggle state flows from ChangesLocal LLM report 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
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
…-toogle # Conflicts: # web-client/src/features/helper/api/queries.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web-client/src/features/helper/pages/HelperPage.tsx (1)
61-66: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove redundant state update.
React batches state updates within event handlers. Calling
setGenerated(false)synchronously beforesetGenerated(true)in the same execution block has no effect, as the intermediatefalsestate 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
📒 Files selected for processing (4)
web-client/src/components/ui/switch.tsxweb-client/src/features/helper/api/queries.tsweb-client/src/features/helper/model/useReportViewModel.tsweb-client/src/features/helper/pages/HelperPage.tsx
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
Bug Fixes