@@ -39190,15 +39190,13 @@ const axios = __nccwpck_require__(73565);
39190
39190
const detect = __nccwpck_require__(46397);
39191
39191
const httpsProxyAgent = __nccwpck_require__(81908);
39192
39192
39193
- function configWithProxy(url ) {
39193
+ function configWithProxy(config ) {
39194
39194
if (process.env.HTTPS_PROXY) {
39195
- return {
39196
- url: url,
39197
- proxy: false,
39198
- httpsAgent: new httpsProxyAgent(process.env.HTTPS_PROXY)
39199
- }
39195
+ config.proxy = false;
39196
+ config.httpsAgent = new httpsProxyAgent(process.env.HTTPS_PROXY);
39197
+ return config;
39200
39198
}
39201
- return url ;
39199
+ return config || {} ;
39202
39200
}
39203
39201
39204
39202
async function run() {
@@ -39228,7 +39226,7 @@ async function run() {
39228
39226
if (content == fullReviewComment) {
39229
39227
// Get the content of the pull request
39230
39228
if (!code) {
39231
- const response = await axios.get(configWithProxy( issue.pull_request.diff_url));
39229
+ const response = await axios.get(issue.pull_request.diff_url, configWithProxy( ));
39232
39230
code = response.data;
39233
39231
}
39234
39232
@@ -39242,7 +39240,7 @@ async function run() {
39242
39240
if (programmingLanguage == 'auto') {
39243
39241
// Get the content of the pull request
39244
39242
if (!code) {
39245
- const response = await axios.get(configWithProxy( issue.pull_request.diff_url));
39243
+ const response = await axios.get(issue.pull_request.diff_url, configWithProxy( ));
39246
39244
code = response.data;
39247
39245
}
39248
39246
const detectedLanguage = detect(code);
@@ -39261,15 +39259,15 @@ async function run() {
39261
39259
core.debug(`content: ${content}`);
39262
39260
39263
39261
// Call the OpenAI ChatGPT API to analyze the code
39264
- const response = await axios.post(configWithProxy( 'https://api.openai.com/v1/chat/completions') , {
39262
+ const response = await axios.post('https://api.openai.com/v1/chat/completions', {
39265
39263
"model": "gpt-3.5-turbo",
39266
39264
"messages": messages
39267
- }, {
39265
+ }, configWithProxy( {
39268
39266
headers: {
39269
39267
'Content-Type': 'application/json',
39270
39268
'Authorization': `Bearer ${openaiToken}`
39271
39269
}
39272
- });
39270
+ })) ;
39273
39271
39274
39272
core.debug(`openai response: ${response.data.choices[0].message.content}`);
39275
39273
0 commit comments