Skip to content
Open
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
10 changes: 9 additions & 1 deletion Open AI Code Review/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OpenAI } from 'openai';
import { ChatGPT } from './chatgpt';
import { Repository } from './repository';
import { PullRequest } from './pullrequest';
import { HttpsProxyAgent } from 'https-proxy-agent';

export class Main {
private static _chatGpt: ChatGPT;
Expand All @@ -25,7 +26,14 @@ export class Main {
const filesToExclude = tl.getInput('file_excludes', false);
const additionalPrompts = tl.getInput('additional_prompts', false)?.split(',')

this._chatGpt = new ChatGPT(new OpenAI({ apiKey: apiKey }), tl.getBoolInput('bugs', true), tl.getBoolInput('performance', true), tl.getBoolInput('best_practices', true), additionalPrompts);
let proxyUrl = tl.getVariable('Agent.ProxyUrl');

if (!proxyUrl) {
this._chatGpt = new ChatGPT(new OpenAI({ apiKey: apiKey }), tl.getBoolInput('bugs', true), tl.getBoolInput('performance', true), tl.getBoolInput('best_practices', true), additionalPrompts);
} else {
this._chatGpt = new ChatGPT(new OpenAI({ apiKey: apiKey, httpAgent: new HttpsProxyAgent(proxyUrl)}), tl.getBoolInput('bugs', true), tl.getBoolInput('performance', true), tl.getBoolInput('best_practices', true), additionalPrompts);
}

this._repository = new Repository();
this._pullRequest = new PullRequest();

Expand Down