mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 07:10:55 +00:00
refactor: update authentication handling and model configuration
- Enhanced authentication method validation in `auth.ts` and `auth.test.ts`. - Introduced new model provider configuration logic - Updated environment variable handling for various auth types. - Removed deprecated utility functions and tests related to fallback mechanisms.
This commit is contained in:
parent
aa9cdf2a3c
commit
db12796df5
53 changed files with 5183 additions and 942 deletions
|
|
@ -45,7 +45,9 @@ export async function initializeApp(
|
|||
// Auto-detect and set LLM output language on first use
|
||||
initializeLlmOutputLanguage();
|
||||
|
||||
const authType = settings.merged.security?.auth?.selectedType;
|
||||
// Use authType from modelsConfig which respects CLI --auth-type argument
|
||||
// over settings.security.auth.selectedType
|
||||
const authType = config.modelsConfig.getCurrentAuthType();
|
||||
const authError = await performInitialAuth(config, authType);
|
||||
|
||||
// Fallback to user select when initial authentication fails
|
||||
|
|
@ -58,8 +60,13 @@ export async function initializeApp(
|
|||
}
|
||||
const themeError = validateTheme(settings);
|
||||
|
||||
// Open auth dialog if:
|
||||
// 1. No authType was explicitly selected (neither from CLI --auth-type nor settings), OR
|
||||
// 2. Authentication failed
|
||||
// wasAuthTypeExplicitlyProvided() returns true if CLI or settings specified authType,
|
||||
// false if using the default QWEN_OAUTH
|
||||
const shouldOpenAuthDialog =
|
||||
settings.merged.security?.auth?.selectedType === undefined || !!authError;
|
||||
!config.modelsConfig.wasAuthTypeExplicitlyProvided() || !!authError;
|
||||
|
||||
if (config.getIdeMode()) {
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue