mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-20 17:46:47 +00:00
commit
2c706a8b55
3 changed files with 1304 additions and 1305 deletions
2600
dist/index.js
vendored
2600
dist/index.js
vendored
File diff suppressed because it is too large
Load diff
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -126,10 +126,6 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
||||||
try {
|
try {
|
||||||
const response = await openai.chat.completions.create({
|
const response = await openai.chat.completions.create({
|
||||||
...queryConfig,
|
...queryConfig,
|
||||||
// return JSON if the model supports it:
|
|
||||||
...(OPENAI_API_MODEL === "gpt-4-1106-preview"
|
|
||||||
? { response_format: { type: "json_object" } }
|
|
||||||
: {}),
|
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: "system",
|
role: "system",
|
||||||
|
@ -138,6 +134,9 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Log the raw response for debugging
|
||||||
|
console.log('Raw response:', response);
|
||||||
|
|
||||||
const res = response.choices[0].message?.content?.trim() || "{}";
|
const res = response.choices[0].message?.content?.trim() || "{}";
|
||||||
return JSON.parse(res).reviews;
|
return JSON.parse(res).reviews;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue