fix(models): resolve configured defaults after automatic fallback (#6949)

* fix(models): resolve configured defaults after automatic fallback

* test: isolate photo routing from external MCP registry state
This commit is contained in:
red person
2026-11-03 00:23:17 +00:00
committed by GitHub
parent 5d4e8d57bb
commit 8532f4606b
2 changed files with 92 additions and 10 deletions
+11 -10
View File
@@ -128,7 +128,7 @@ async function _ensureDefaultPendingChat() {
if (!_deps || _defaultChatPickInFlight) return;
if (_deps.getCurrentSessionId && _deps.getCurrentSessionId()) return;
const pending = _deps.getPendingChat && _deps.getPendingChat();
if (pending && pending.modelId) return;
if (pending && pending.modelId && pending.source !== 'fallback') return;
_defaultChatPickInFlight = true;
const seq = ++_defaultPendingSeq;
try {
@@ -954,15 +954,6 @@ export function updateModelPicker() {
}
}
const latestPending = _deps.getPendingChat && _deps.getPendingChat();
if (
!currentSessionId &&
!_autoSelectingDefault &&
window.modelsModule &&
window.modelsModule.getCachedItems &&
(!modelId || (latestPending && latestPending.source === 'fallback'))
) {
_ensureDefaultPendingChat();
}
let displayName = modelId ? modelId.split('/').pop() : 'Select model';
const routeItems = window.modelsModule?.getCachedItems?.() || [];
@@ -994,6 +985,16 @@ export function updateModelPicker() {
label.textContent = displayName;
}
_updateReasoningEffortUI(modelId, s, latestPending, selectedEndpoint);
// A cached default can resolve synchronously and re-render the picker.
if (
!currentSessionId &&
!_autoSelectingDefault &&
window.modelsModule &&
window.modelsModule.getCachedItems &&
(!modelId || (latestPending && latestPending.source === 'fallback'))
) {
_ensureDefaultPendingChat();
}
}
// ── Reasoning effort control for models supporting reasoning levels ──