mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 23:42:03 +00:00
fix(cli): update regionName format from 'Bailian Coding Plan (Global/Intl)' to 'Coding Plan (Bailian, Global/Intl)'
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
c1789a0458
commit
78a4ab1b48
10 changed files with 79 additions and 62 deletions
|
|
@ -80,7 +80,7 @@ export function AuthDialog(): React.JSX.Element {
|
|||
},
|
||||
{
|
||||
key: 'coding-plan-intl',
|
||||
label: t('Bailian Coding Plan (Global/Intl)'),
|
||||
label: t('Coding Plan (Bailian, Global/Intl)'),
|
||||
value: 'coding-plan-intl' as ApiKeySubMode,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ describe('useCodingPlanUpdates', () => {
|
|||
const mockConfig = {
|
||||
reloadModelProvidersConfig: vi.fn(),
|
||||
refreshAuth: vi.fn(),
|
||||
getModel: vi.fn().mockReturnValue('qwen-max'),
|
||||
};
|
||||
|
||||
const mockAddItem = vi.fn();
|
||||
|
|
|
|||
|
|
@ -82,7 +82,22 @@ export function useCodingPlanUpdates(
|
|||
...(nonCodingPlanConfigs as Array<Record<string, unknown>>),
|
||||
] as Array<Record<string, unknown>>;
|
||||
|
||||
// Persist updated model providers
|
||||
// Hot-reload model providers configuration first (in-memory only)
|
||||
const updatedModelProviders = {
|
||||
...(settings.merged.modelProviders as
|
||||
| Record<string, unknown>
|
||||
| undefined),
|
||||
[AuthType.USE_OPENAI]: updatedConfigs,
|
||||
};
|
||||
config.reloadModelProvidersConfig(
|
||||
updatedModelProviders as unknown as ModelProvidersConfig,
|
||||
);
|
||||
|
||||
// Refresh auth with the new configuration
|
||||
// This validates the configuration before persisting
|
||||
await config.refreshAuth(AuthType.USE_OPENAI);
|
||||
|
||||
// Persist to settings only after successful auth refresh
|
||||
settings.setValue(
|
||||
persistScope,
|
||||
`modelProviders.${AuthType.USE_OPENAI}`,
|
||||
|
|
@ -95,26 +110,14 @@ export function useCodingPlanUpdates(
|
|||
// Update the region
|
||||
settings.setValue(persistScope, 'codingPlan.region', region);
|
||||
|
||||
// Hot-reload model providers configuration
|
||||
const updatedModelProviders = {
|
||||
...(settings.merged.modelProviders as
|
||||
| Record<string, unknown>
|
||||
| undefined),
|
||||
[AuthType.USE_OPENAI]: updatedConfigs,
|
||||
};
|
||||
config.reloadModelProvidersConfig(
|
||||
updatedModelProviders as unknown as ModelProvidersConfig,
|
||||
);
|
||||
|
||||
// Refresh auth with the new configuration
|
||||
await config.refreshAuth(AuthType.USE_OPENAI);
|
||||
const activeModel = config.getModel();
|
||||
|
||||
addItem(
|
||||
{
|
||||
type: 'info',
|
||||
text: t(
|
||||
'{{region}} configuration updated successfully. New models are now available.',
|
||||
{ region: regionName },
|
||||
'{{region}} configuration updated successfully. Model switched to "{{model}}".',
|
||||
{ region: regionName, model: activeModel },
|
||||
),
|
||||
},
|
||||
Date.now(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue