mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
fix: remove authType fallback option for cold start case
This commit is contained in:
parent
2662639280
commit
85bc0833b4
8 changed files with 70 additions and 46 deletions
|
|
@ -20,21 +20,27 @@ export async function validateNonInteractiveAuth(
|
|||
try {
|
||||
// Get the actual authType from config which has already resolved CLI args, env vars, and settings
|
||||
const authType = nonInteractiveConfig.modelsConfig.getCurrentAuthType();
|
||||
if (!authType) {
|
||||
throw new Error(
|
||||
'No auth type is selected. Please configure an auth type (e.g. via settings) before running in non-interactive mode.',
|
||||
);
|
||||
}
|
||||
const resolvedAuthType: NonNullable<typeof authType> = authType;
|
||||
|
||||
const enforcedType = settings.merged.security?.auth?.enforcedType;
|
||||
if (enforcedType && enforcedType !== authType) {
|
||||
const message = `The configured auth type is ${enforcedType}, but the current auth type is ${authType}. Please re-authenticate with the correct type.`;
|
||||
if (enforcedType && enforcedType !== resolvedAuthType) {
|
||||
const message = `The configured auth type is ${enforcedType}, but the current auth type is ${resolvedAuthType}. Please re-authenticate with the correct type.`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
if (!useExternalAuth) {
|
||||
const err = validateAuthMethod(authType, nonInteractiveConfig);
|
||||
const err = validateAuthMethod(resolvedAuthType, nonInteractiveConfig);
|
||||
if (err != null) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
await nonInteractiveConfig.refreshAuth(authType);
|
||||
await nonInteractiveConfig.refreshAuth(resolvedAuthType);
|
||||
return nonInteractiveConfig;
|
||||
} catch (error) {
|
||||
const outputFormat = nonInteractiveConfig.getOutputFormat();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue