Skip to content

fix(ai): prefer configured model after provider switch - #541

Merged
youxi798 merged 2 commits into
tw93:mainfrom
trxuan:fix/stale-model-provider-switch
Aug 28, 2026
Merged

fix(ai): prefer configured model after provider switch#541
youxi798 merged 2 commits into
tw93:mainfrom
trxuan:fix/stale-model-provider-switch

Conversation

@trxuan

@trxuan trxuan commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the explicitly configured chat model at the front of a fetched model list
  • restore a saved model only when the current provider also advertises it
  • replace a stale cross-provider selection with the configured model instead of showing (list failed) and selecting the provider's first model

Root cause

The chat overlay stores last_model globally. After switching providers, a saved model from the previous provider may not exist in the new provider's successful /models response. The overlay currently treats that mismatch as a failed model fetch and resets model_index to the first server model, even when the configured chat_model is present.

Tests

Added regression coverage for:

  • a stale model from another provider falling back to the configured model
  • a valid saved model remaining selected
  • a manually configured model remaining available when omitted from /models

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@trxuan is attempting to deploy a commit to the Faberon Team on Vercel.

A member of the Team first needs to authorize it.

@youxi798
youxi798 marked this pull request as ready for review August 28, 2026 11:49
@youxi798
youxi798 merged commit 43774f5 into tw93:main Aug 28, 2026
7 of 8 checks passed
@youxi798

Copy link
Copy Markdown
Collaborator

@trxuan Thanks for the provider-switch fix. I tightened the model state so cached lists stay scoped to the current endpoint, Follow Codex resolves to a discovered model, and background refreshes no longer overwrite an explicit choice.

This is merged and available in the latest Nightly: https://github.com/tw93/Kaku/releases/tag/nightly

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