Skip to content

fix: prevent STT and refinement model settings from being randomly overwritten#58

Open
yixin0829 wants to merge 1 commit intodevelopfrom
fix/config-gui-model-overwrite-bug
Open

fix: prevent STT and refinement model settings from being randomly overwritten#58
yixin0829 wants to merge 1 commit intodevelopfrom
fix/config-gui-model-overwrite-bug

Conversation

@yixin0829
Copy link
Copy Markdown
Owner

Summary

  • Fixed bug where STT model and Refinement Model settings were randomly overwritten in the config GUI
  • Root cause: provider-specific caching mechanism was not properly syncing with GUI state
  • Added sync helper methods to keep cache in sync regardless of whether values are typed or selected
  • Used list membership to correctly determine which provider's cache to update when switching providers

Changes

  • Added _sync_stt_model_to_cache() and _sync_refinement_model_to_cache() helper methods
  • Simplified _on_stt_model_changed() and _on_refinement_model_changed() to use sync helpers
  • Fixed _update_stt_model_options() and _update_refinement_model_options() to:
    • Save to PREVIOUS provider's cache using list membership (since provider var is already updated)
    • Restore from cache without list validation (preserves custom/non-listed models)
  • Updated set_values() to call sync methods after setting model values

Test plan

  • All 242 existing tests pass
  • Verified test_stt_model_preserved_when_switching_providers passes
  • Manual test: Type custom model name, click provider dropdown - model should be preserved
  • Manual test: Load config with non-listed model - model should be preserved
  • Manual test: Switch providers back and forth - models should be remembered per provider

🤖 Generated with Claude Code

…erwritten

The config GUI was randomly overwriting user's model selections due to
provider-specific caching issues:

1. Cache only updated on <<ComboboxSelected>>, missing typed values
2. List validation reset non-listed models to first dropdown item
3. Sync methods used new provider instead of old when switching

Fixes:
- Add _sync_stt_model_to_cache() and _sync_refinement_model_to_cache()
  helper methods to keep cache in sync with GUI state
- Use list membership to determine which provider's cache to save to
  when switching providers (since provider var is already updated)
- Remove list validation when restoring from cache to preserve
  custom/non-listed models
- Call sync methods in set_values() to handle config loading

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 68.06723% with 76 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/push_to_talk.py 59.21% 31 Missing ⚠️
src/text_refiner_gemini.py 35.71% 27 Missing ⚠️
src/audio_recorder.py 59.25% 11 Missing ⚠️
src/hotkey_service.py 75.00% 5 Missing ⚠️
src/text_refiner_cerebras.py 77.77% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@yixin0829 yixin0829 changed the base branch from main to develop January 2, 2026 17:54
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.

2 participants