Skip to content

Commit be2b7f8

Browse files
Merge pull request #113 from DiogoRibeiro7/chore/restart
chore: develop
2 parents 234dc7d + 16a6a71 commit be2b7f8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/llm/generateIssueContent.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ BODY:
2727
`;
2828
// 👇 Adiciona aqui
2929
console.log('[DEBUG] OpenAI key starts with:', process.env.OPENAI_API_KEY?.slice(0, 5));
30-
30+
console.log('[DEBUG] Sending prompt to OpenAI...');
31+
try {
3132
const response = await openai.chat.completions.create({
3233
model: 'gpt-4',
3334
messages: [{ role: 'user', content: prompt }],
3435
temperature: 0.4,
3536
});
36-
// TODO(priority=high): improve retry logic for API errors
37+
// TODO(priority=high): improve retry logic for API errors
3738
const result = response.choices[0].message?.content || '';
3839
const match = result.match(/TITLE:\s*(.+?)\s*BODY:\s*([\s\S]*)/i);
3940

@@ -43,4 +44,9 @@ BODY:
4344

4445
const [, title, body] = match;
4546
return { title: title.trim(), body: body.trim() };
47+
} catch (err: any) {
48+
console.error('[ERROR] OpenAI call failed:', err);
49+
throw err;
50+
}
4651
}
52+

0 commit comments

Comments
 (0)