Files
gemini-cli/packages/core/src/code_assist/codeAssist.ts

24 lines
727 B
TypeScript
Raw Normal View History

2025-06-10 16:00:13 -07:00
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { AuthType, ContentGenerator } from '../core/contentGenerator.js';
2025-06-11 13:26:41 -07:00
import { getOauthClient } from './oauth2.js';
2025-06-10 16:00:13 -07:00
import { setupUser } from './setup.js';
import { CodeAssistServer, HttpOptions } from './server.js';
2025-06-10 16:00:13 -07:00
export async function createCodeAssistContentGenerator(
httpOptions: HttpOptions,
authType: AuthType,
): Promise<ContentGenerator> {
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
const authClient = await getOauthClient();
const projectId = await setupUser(authClient);
return new CodeAssistServer(authClient, projectId, httpOptions);
}
throw new Error(`Unsupported authType: ${authType}`);
}