feat: add model picker UI and wire model param through backend #353

Merged
AI-Manager merged 2 commits from feature/351-frontend-model-picker into main 2026-03-27 16:45:08 +00:00
Owner

Summary

  • Add LLM model selector dropdown to Analysis and Batch pages
  • Thread model parameter through the full backend pipeline: API endpoints -> analyzer -> LLM
  • Add listModels() API client method to fetch available models from GET /models
  • Single company endpoint now accepts ?model= query parameter
  • Batch and async batch endpoints now pass request.model to the analyzer

Closes #351

Files Changed

  • SPARC/analyzer.py -- Added model parameter to analyze_company, _analyze_company_safe, analyze_companies, analyze_single_patent
  • SPARC/api.py -- Added model query param to single company endpoint; pass request.model in batch endpoints
  • frontend/src/api/client.ts -- Added model param to analyzeCompany, analyzeBatch, analyzeBatchAsync; added listModels() and model types
  • frontend/src/pages/Analysis.tsx -- Added model selector dropdown with data from /models API
  • frontend/src/pages/Batch.tsx -- Added model selector dropdown alongside workers slider

Test Plan

  • Verify model dropdown loads the curated list from GET /models
  • Submit an analysis with a non-default model and confirm the model is used
  • Submit a batch analysis with a selected model
  • Verify default behavior (no model selected) still works
  • Run npx tsc --noEmit to confirm no TypeScript errors
## Summary - Add LLM model selector dropdown to Analysis and Batch pages - Thread `model` parameter through the full backend pipeline: API endpoints -> analyzer -> LLM - Add `listModels()` API client method to fetch available models from `GET /models` - Single company endpoint now accepts `?model=` query parameter - Batch and async batch endpoints now pass `request.model` to the analyzer Closes #351 ## Files Changed - `SPARC/analyzer.py` -- Added `model` parameter to `analyze_company`, `_analyze_company_safe`, `analyze_companies`, `analyze_single_patent` - `SPARC/api.py` -- Added `model` query param to single company endpoint; pass `request.model` in batch endpoints - `frontend/src/api/client.ts` -- Added `model` param to `analyzeCompany`, `analyzeBatch`, `analyzeBatchAsync`; added `listModels()` and model types - `frontend/src/pages/Analysis.tsx` -- Added model selector dropdown with data from `/models` API - `frontend/src/pages/Batch.tsx` -- Added model selector dropdown alongside workers slider ## Test Plan - Verify model dropdown loads the curated list from `GET /models` - Submit an analysis with a non-default model and confirm the model is used - Submit a batch analysis with a selected model - Verify default behavior (no model selected) still works - Run `npx tsc --noEmit` to confirm no TypeScript errors
AI-Manager added 1 commit 2026-03-27 16:13:21 +00:00
Thread the optional model parameter through the entire analysis pipeline:
- analyzer.py: analyze_company, _analyze_company_safe, analyze_companies,
  and analyze_single_patent now accept and forward model override
- api.py: single company endpoint accepts model query param; batch and
  async batch endpoints pass request.model through to the analyzer
- client.ts: analyzeCompany, analyzeBatch, analyzeBatchAsync accept model;
  add listModels() to fetch available models from GET /models
- Analysis.tsx: add model selector dropdown that loads from /models API
- Batch.tsx: add model selector alongside the workers slider

Users can now pick a specific LLM (GPT-4o, Claude 3.5, Gemini, etc.)
per analysis request, or leave it on the server default.

Closes leeworks-agents/SPARC#351

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-Manager added 1 commit 2026-03-27 16:44:54 +00:00
Combine both useQuery hooks (modelsQuery for model selector, jobsQuery for
job history) and pass selectedModel to analyzeBatch while also triggering
jobsQuery.refetch() on successful submission.
AI-Manager merged commit c72a44aa56 into main 2026-03-27 16:45:08 +00:00
Sign in to join this conversation.