-
Notifications
You must be signed in to change notification settings - Fork 492
feat: auto-set Pro models after sign-in while preserving previous configs #3306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: auto-set Pro models after sign-in while preserving previous configs #3306
Conversation
…figs - Save current STT/LLM configuration before logout to pre_logout_* settings - On sign-in, restore saved configurations if they exist, otherwise set to Pro models - Clear saved pre-logout configs after restoration Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
👷 Deploy Preview for hyprnote-storybook processing.
|
✅ Deploy Preview for hyprnote canceled.
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
❌ Deploy Preview for howto-fix-macos-audio-selection failed.
|
- On becoming Pro: save current non-Pro config to pre_pro_* fields, then set Pro models - On sign-out: restore pre_pro_* config if exists, otherwise clear settings - Renamed pre_logout_* to pre_pro_* for clearer semantics - Added store-level tests for the Pro model auto-config flow Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
| const preProSttProvider = store.getValue("pre_pro_stt_provider"); | ||
| const preProSttModel = store.getValue("pre_pro_stt_model"); | ||
| const preProLlmProvider = store.getValue("pre_pro_llm_provider"); | ||
| const preProLlmModel = store.getValue("pre_pro_llm_model"); | ||
|
|
||
| if (currentSttProvider === "hyprnote" && currentSttModel === "cloud") { | ||
| if (preProSttProvider) { | ||
| store.setValue("current_stt_provider", preProSttProvider); | ||
| store.setValue("current_stt_model", preProSttModel ?? ""); | ||
| } else { | ||
| store.setValue("current_stt_provider", ""); | ||
| store.setValue("current_stt_model", ""); | ||
| } | ||
|
|
||
| if (currentLlmProvider === "hyprnote") { | ||
| if (preProLlmProvider) { | ||
| store.setValue("current_llm_provider", preProLlmProvider); | ||
| store.setValue("current_llm_model", preProLlmModel ?? ""); | ||
| } else { | ||
| store.setValue("current_llm_provider", ""); | ||
| store.setValue("current_llm_model", ""); | ||
| } | ||
|
|
||
| store.setValue("pre_pro_stt_provider", ""); | ||
| store.setValue("pre_pro_stt_model", ""); | ||
| store.setValue("pre_pro_llm_provider", ""); | ||
| store.setValue("pre_pro_llm_model", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Critical Step: The sign-out flow reads and restores pre_pro_* configs but never saves the current Pro configuration before clearing.
What breaks: If a user manually customized their Pro settings (e.g., changed from default hyprnote models to specific models), those customizations are lost on sign-out. The code only restores configs that were saved when first becoming Pro, not the current state at sign-out time.
Impact: User loses any Pro configuration changes they made between sign-in and sign-out.
Fix: Save current config before restoration:
if (store) {
// Save current Pro settings before clearing
const currentSttProvider = store.getValue("current_stt_provider");
const currentSttModel = store.getValue("current_stt_model");
const currentLlmProvider = store.getValue("current_llm_provider");
const currentLlmModel = store.getValue("current_llm_model");
if (currentSttProvider === "hyprnote") {
store.setValue("pre_logout_stt_provider", currentSttProvider);
store.setValue("pre_logout_stt_model", currentSttModel ?? "");
}
if (currentLlmProvider === "hyprnote") {
store.setValue("pre_logout_llm_provider", currentLlmProvider);
store.setValue("pre_logout_llm_model", currentLlmModel ?? "");
}
// Then restore pre-Pro configs or clear
const preProSttProvider = store.getValue("pre_pro_stt_provider");
// ... rest of the logic
}Note: This requires adding pre_logout_* settings to settings.ts as mentioned in the PR description but missing from implementation.
| const preProSttProvider = store.getValue("pre_pro_stt_provider"); | |
| const preProSttModel = store.getValue("pre_pro_stt_model"); | |
| const preProLlmProvider = store.getValue("pre_pro_llm_provider"); | |
| const preProLlmModel = store.getValue("pre_pro_llm_model"); | |
| if (currentSttProvider === "hyprnote" && currentSttModel === "cloud") { | |
| if (preProSttProvider) { | |
| store.setValue("current_stt_provider", preProSttProvider); | |
| store.setValue("current_stt_model", preProSttModel ?? ""); | |
| } else { | |
| store.setValue("current_stt_provider", ""); | |
| store.setValue("current_stt_model", ""); | |
| } | |
| if (currentLlmProvider === "hyprnote") { | |
| if (preProLlmProvider) { | |
| store.setValue("current_llm_provider", preProLlmProvider); | |
| store.setValue("current_llm_model", preProLlmModel ?? ""); | |
| } else { | |
| store.setValue("current_llm_provider", ""); | |
| store.setValue("current_llm_model", ""); | |
| } | |
| store.setValue("pre_pro_stt_provider", ""); | |
| store.setValue("pre_pro_stt_model", ""); | |
| store.setValue("pre_pro_llm_provider", ""); | |
| store.setValue("pre_pro_llm_model", ""); | |
| // Save current Pro settings before clearing | |
| const currentSttProvider = store.getValue("current_stt_provider"); | |
| const currentSttModel = store.getValue("current_stt_model"); | |
| const currentLlmProvider = store.getValue("current_llm_provider"); | |
| const currentLlmModel = store.getValue("current_llm_model"); | |
| if (currentSttProvider === "hyprnote") { | |
| store.setValue("pre_logout_stt_provider", currentSttProvider); | |
| store.setValue("pre_logout_stt_model", currentSttModel ?? ""); | |
| } | |
| if (currentLlmProvider === "hyprnote") { | |
| store.setValue("pre_logout_llm_provider", currentLlmProvider); | |
| store.setValue("pre_logout_llm_model", currentLlmModel ?? ""); | |
| } | |
| // Then restore pre-Pro configs or clear | |
| const preProSttProvider = store.getValue("pre_pro_stt_provider"); | |
| const preProSttModel = store.getValue("pre_pro_stt_model"); | |
| const preProLlmProvider = store.getValue("pre_pro_llm_provider"); | |
| const preProLlmModel = store.getValue("pre_pro_llm_model"); | |
| if (preProSttProvider) { | |
| store.setValue("current_stt_provider", preProSttProvider); | |
| store.setValue("current_stt_model", preProSttModel ?? ""); | |
| } else { | |
| store.setValue("current_stt_provider", ""); | |
| store.setValue("current_stt_model", ""); | |
| } | |
| if (preProLlmProvider) { | |
| store.setValue("current_llm_provider", preProLlmProvider); | |
| store.setValue("current_llm_model", preProLlmModel ?? ""); | |
| } else { | |
| store.setValue("current_llm_provider", ""); | |
| store.setValue("current_llm_model", ""); | |
| } | |
| store.setValue("pre_pro_stt_provider", ""); | |
| store.setValue("pre_pro_stt_model", ""); | |
| store.setValue("pre_pro_llm_provider", ""); | |
| store.setValue("pre_pro_llm_model", ""); |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Summary
After signing in to the desktop app, this PR automatically sets transcription and intelligence models to Hyprnote Pro models, while preserving any previous configurations the user had before becoming Pro.
How it works:
isProtransitions from false to true):pre_pro_*settings (skipped if already using hyprnote provider)pre_pro_*configs exist → restore thempre_pro_*values after restorationExpected flow:
Provider A, Model B→ sign in → auto-set to Pro → sign out → restoreProvider A, Model BFiles changed:
settings.ts: Added 4 new settings values (pre_pro_stt_provider,pre_pro_stt_model,pre_pro_llm_provider,pre_pro_llm_model)account.tsx: On sign-out, restore pre-Pro config if exists, then clear saved valuesuseProModelAutoConfig.ts: On becoming Pro, save current non-Pro config before setting Pro modelsuseProModelAutoConfig.test.ts: Added store-level tests for the Pro model auto-config flowReview & Testing Checklist for Human
isProtransition timing: The hook only triggers whenisProgoes fromfalsetotrue- verify this works correctly with the billing/auth flowNotes
["ai", "pre_pro_*"]path in the settings storeLink to Devin run: https://app.devin.ai/sessions/4beb976d26874042aba2cc9cb6f1f533
Requested by: @ComputelessComputer