Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ng-dev/ai/fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ function builder(argv: Argv): Argv<Options> {

/** Yargs command handler for the command. */
async function handler(options: Arguments<Options>) {
const apiKey = options.apiKey || DEFAULT_API_KEY;

assert(
options.apiKey,
apiKey,
[
'No API key configured. A Gemini API key must be set as the `GEMINI_API_KEY` environment ' +
'variable, or passed in using the `--api-key` flag.',
Expand All @@ -89,7 +91,7 @@ async function handler(options: Arguments<Options>) {
);

const fixedContents = await fixFilesWithAI(
options.apiKey,
apiKey,
options.files,
options.error,
options.model,
Expand Down
7 changes: 4 additions & 3 deletions ng-dev/ai/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ function builder(argv: Argv): Argv<Options> {
.option('apiKey', {
type: 'string',
alias: 'a',
default: DEFAULT_API_KEY,
description: 'API key used when making calls to the Gemini API',
});
}

/** Yargs command handler for the command. */
async function handler(options: Arguments<Options>) {
const apiKey = options.apiKey || DEFAULT_API_KEY;

assert(
options.apiKey,
apiKey,
[
'No API key configured. A Gemini API key must be set as the `GEMINI_API_KEY` environment ' +
'variable, or passed in using the `--api-key` flag.',
Expand All @@ -98,7 +99,7 @@ async function handler(options: Arguments<Options>) {
process.exit(1);
}

const ai = new GoogleGenAI({apiKey: options.apiKey});
const ai = new GoogleGenAI({apiKey});
const progressBar = new SingleBar({}, Presets.shades_grey);
const failures: {name: string; error: string}[] = [];
const running = new Set<Promise<void>>();
Expand Down
Loading