File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { Octokit } from "@octokit/rest";
55import parseDiff , { Chunk , File } from "parse-diff" ;
66import minimatch from "minimatch" ;
77import { parse } from "path" ;
8+ import { APIPromise } from "openai/core" ;
89
910const GITHUB_TOKEN : string = core . getInput ( "GITHUB_TOKEN" ) ;
1011const OPENAI_API_KEY : string = core . getInput ( "OPENAI_API_KEY" ) ;
@@ -132,11 +133,12 @@ async function getAIResponse(prompt: string): Promise<Array<{
132133 presence_penalty : 0 ,
133134 } ;
134135
136+ let response : OpenAI . Chat . Completions . ChatCompletion | null = null ;
135137 try {
136- const response = await openai . chat . completions . create ( {
138+ response = await openai . chat . completions . create ( {
137139 ...queryConfig ,
138140 // return JSON if the model supports it:
139- response_format : { type : "json_object" } ,
141+ response_format : { type : "json_object" as const } ,
140142 messages : [
141143 {
142144 role : "system" ,
@@ -156,7 +158,7 @@ async function getAIResponse(prompt: string): Promise<Array<{
156158 const res = response . choices [ 0 ] . message ?. content ?. trim ( ) || "{}" ;
157159 return JSON . parse ( res ) . reviews ;
158160 } catch ( error ) {
159- console . error ( "Error:" , error ) ;
161+ console . error ( "Error:" , error , response ?. choices [ 0 ] . message ?. content ) ;
160162 return null ;
161163 }
162164}
You can’t perform that action at this time.
0 commit comments