mirror of
https://github.com/LearningCircuit/local-deep-research.git
synced 2026-06-16 03:51:07 +03:00
* fix: resolve provider selection case mismatch and inconsistent defaults Fixes #3339 - LLM provider dropdown broken on fresh install due to case mismatch between stored values (OLLAMA) and dropdown option values (ollama). Also fixes corruption-fix defaults using openai instead of ollama, and inconsistent gemma:latest fallback vs gemma3:12b in default_settings.json. * revert: remove unrelated themes.css changes from PR * refactor: add normalize_provider() and enforce lowercase canonical form Replace ad-hoc .upper()/.lower() calls with a centralized normalize_provider() function in llm/providers/base.py. This establishes lowercase as the single canonical form for provider values, matching VALID_PROVIDERS and get_llm(). Key changes: - Add normalize_provider() as module-level function in base.py - Use normalize_provider() in get_llm(), research_routes, followup routes - Fix research_routes comparisons to use lowercase ("ollama", "openai_endpoint") - Lowercase all hardcoded provider fallbacks in news module - Lowercase provider tags in settings_routes model listings - Lowercase fallback model options in settings.js - Remove llm.provider from KNOWN_SELECT_ISSUES (case mismatch fixed) - Update remaining gemma:latest references to gemma3:12b in tests/examples * refactor: adopt normalize_provider() across remaining codebase Extend normalize_provider() usage to all locations that previously used ad-hoc .lower()/.upper() calls or compared provider strings without normalization. High priority (fixes silent comparison failures): - benchmark_routes.py: 12 provider comparisons now normalized - benchmark_functions.py: 6 evaluation_provider comparisons - graders.py: 1 provider comparison - api_routes.py: 2 bare .lower() calls replaced - pricing_fetcher.py: 2 bare .lower() calls (one had no None guard) - wrapper.py: 1 bare .lower() call replaced - llm_config.py: get_selected_llm_provider() uses normalize_provider() Medium priority (normalize at DB write boundaries): - news/api.py: normalize before writing to NewsSubscription - news/flask_api.py: normalize at HTTP input boundary Low priority (consistency): - settings_routes.py: dict key construction uses normalize_provider() - auto_discovery.py: register_llm() uses normalize_provider() * fix(test): update assertions to expect lowercase provider after normalize_provider() Tests were asserting uppercase provider strings (e.g., "OPENAI", "OLLAMA") but normalize_provider() now returns lowercase canonical forms. Updated expected values in 8 failing tests across 4 files while keeping test inputs uppercase to verify normalization works correctly.