Skip to content

Fix configured model not taking effect for newly created providers#1184

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-configured-model-issue
Draft

Fix configured model not taking effect for newly created providers#1184
Copilot wants to merge 2 commits intomainfrom
copilot/fix-configured-model-issue

Conversation

Copy link

Copilot AI commented Feb 8, 2026

After configuring a new custom model provider (e.g., minimax), the system continues using the cloud model (e.g., Claude) because setModelType('custom') never executes.

Root cause

In handleVerify, after saving a new provider, the flow is:

  1. setForm(...) — async React state update with the new provider_id
  2. handleSwitch(idx, true) — reads form[idx].provider_id from the stale closure

For new providers, provider_id is still undefined at step 2, so the /api/provider/prefer call fails validation (provider_id: int), the catch swallows the error, and setModelType('custom') inside the try block is skipped.

Fix

  • Add optional providerId parameter to handleSwitch (mirrors existing pattern in handleLocalSwitch)
  • In handleVerify, extract provider_id from the freshly fetched provider list and pass it directly:
const savedProvider = providerList.find(
  (p: any) => p.provider_name === item.id
);

if (savedProvider?.id) {
  await handleSwitch(idx, true, savedProvider.id);
}
const handleSwitch = async (
  idx: number,
  checked: boolean,
  providerId?: number  // new optional param
) => {
  // ...
  await proxyFetchPost('/api/provider/prefer', {
    provider_id: providerId ?? form[idx].provider_id,
  });
  setModelType('custom');
  // ...
};
Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] configured model doesn't take effect</issue_title>
<issue_description>### What version of eigent are you using?

0.0.82

System information

windows 11

Problem description

I set a api model minimax, but when I ask , I found the model take no effect.
ask which model are you use.
It said claude

Image

log

no

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@Wendong-Fan hey @kevinew , could you provide a screenshot of the model setting part? also it may not reliable to ask agent/llm "which model you are"

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

After creating/updating a provider, handleSwitch was called using stale
React form state where provider_id was undefined for new providers. This
caused the /api/provider/prefer API call to fail silently, preventing
setModelType('custom') from executing and leaving modelType as 'cloud'.

Fix: Add optional providerId parameter to handleSwitch (matching existing
pattern in handleLocalSwitch), and pass the freshly fetched provider_id
from the API response directly to handleSwitch.

Co-authored-by: lightaime <23632352+lightaime@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix configured model not taking effect in API Fix configured model not taking effect for newly created providers Feb 8, 2026
Copilot AI requested a review from lightaime February 8, 2026 02:43
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.

[BUG] configured model doesn't take effect

2 participants