Repository navigation
Chat always runs the saved model, so Free models can't turn into the paid router - #16
Open
GrantCharge wants to merge 1 commit into
Open
GrantCharge wants to merge 1 commit into
GrantCharge wants to merge 1 commit into
Conversation
…paid router An open chat panel kept sending its older pick (openrouter/auto) after the user switched to Free models elsewhere, and chatProvider trusted it over the saved user_metadata.ai_model. The saved choice now wins; the panel's choice counts only when nothing is saved. The panel also follows picks made on other pages, reloads the saved choice on open and on tab focus, and saves its own pick before the next question goes out. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15
Problem
After switching OpenRouter back to Free models, an already-open chat panel kept sending its older pick,
openrouter/auto("uses your credits").chatProvidertrusted what the panel sent over the saveduser_metadata.ai_model. So the Connect page said "Free models" and chat still spent credits.Change
src/lib/llm/models.ts: newchatChoice(saved, asked). The saved choice wins. The panel's choice is used only when nothing is saved.src/lib/llm/gate.ts:chatProvideruseschatChoice.src/app/api/assistant/route.ts: comment updated.src/components/Assistant.tsx:saveChoicetells an open panel about the new pick, so a pick on Connect your AI or Settings shows in the header at once.src/lib/llm/models.test.ts: tests forchatChoice, including a staleopenrouter/autopanel against a saved free choice.Check-ins and the money plan already used the saved choice (
pickProvider), so they are unchanged.Tests
node src/lib/llm/models.test.tspasses.configanddispatchtests still pass.tsc --noEmitandeslintpass on the changed files.Notes
🤖 Generated with Claude Code