Rename AuthType LOGIN_WITH_GOOGLE_PERSONAL -> LOGIN_WITH_GOOGLE (#2769)

This commit is contained in:
Tommaso Sciortino
2025-06-30 17:11:54 -07:00
committed by GitHub
parent 0ca5c07135
commit 3587054d32
13 changed files with 16 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ export async function createCodeAssistContentGenerator(
httpOptions: HttpOptions,
authType: AuthType,
): Promise<ContentGenerator> {
if (authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
const authClient = await getOauthClient();
const projectId = await setupUser(authClient);
return new CodeAssistServer(authClient, projectId, httpOptions);

View File

@@ -491,7 +491,7 @@ export class GeminiClient {
*/
private async handleFlashFallback(authType?: string): Promise<string | null> {
// Only handle fallback for OAuth users
if (authType !== AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
if (authType !== AuthType.LOGIN_WITH_GOOGLE) {
return null;
}

View File

@@ -20,7 +20,7 @@ describe('contentGenerator', () => {
);
const generator = await createContentGenerator({
model: 'test-model',
authType: AuthType.LOGIN_WITH_GOOGLE_PERSONAL,
authType: AuthType.LOGIN_WITH_GOOGLE,
});
expect(createCodeAssistContentGenerator).toHaveBeenCalled();
expect(generator).toBe(mockGenerator);

View File

@@ -35,7 +35,7 @@ export interface ContentGenerator {
}
export enum AuthType {
LOGIN_WITH_GOOGLE_PERSONAL = 'oauth-personal',
LOGIN_WITH_GOOGLE = 'oauth-personal',
USE_GEMINI = 'gemini-api-key',
USE_VERTEX_AI = 'vertex-ai',
}
@@ -66,7 +66,7 @@ export async function createContentGeneratorConfig(
};
// if we are using google auth nothing else to validate for now
if (authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
return contentGeneratorConfig;
}
@@ -108,7 +108,7 @@ export async function createContentGenerator(
'User-Agent': `GeminiCLI/${version} (${process.platform}; ${process.arch})`,
},
};
if (config.authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
if (config.authType === AuthType.LOGIN_WITH_GOOGLE) {
return createCodeAssistContentGenerator(httpOptions, config.authType);
}

View File

@@ -193,7 +193,7 @@ export class GeminiChat {
*/
private async handleFlashFallback(authType?: string): Promise<string | null> {
// Only handle fallback for OAuth users
if (authType !== AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
if (authType !== AuthType.LOGIN_WITH_GOOGLE) {
return null;
}

View File

@@ -78,14 +78,14 @@ describe('Flash Fallback Integration', () => {
return status === 429;
},
onPersistent429: mockFallbackHandler,
authType: AuthType.LOGIN_WITH_GOOGLE_PERSONAL,
authType: AuthType.LOGIN_WITH_GOOGLE,
});
// Verify fallback was triggered
expect(fallbackCalled).toBe(true);
expect(fallbackModel).toBe(DEFAULT_GEMINI_FLASH_MODEL);
expect(mockFallbackHandler).toHaveBeenCalledWith(
AuthType.LOGIN_WITH_GOOGLE_PERSONAL,
AuthType.LOGIN_WITH_GOOGLE,
);
expect(result).toBe('success after fallback');
// Should have: 2 failures, then fallback triggered, then 1 success after retry reset

View File

@@ -97,7 +97,7 @@ export async function retryWithBackoff<T>(
if (
consecutive429Count >= 2 &&
onPersistent429 &&
authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL
authType === AuthType.LOGIN_WITH_GOOGLE
) {
try {
const fallbackModel = await onPersistent429(authType);