Skip to content
Merged
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: 8 additions & 2 deletions src/core/llm/generateIssueContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ BODY:
`;
// 👇 Adiciona aqui
console.log('[DEBUG] OpenAI key starts with:', process.env.OPENAI_API_KEY?.slice(0, 5));

console.log('[DEBUG] Sending prompt to OpenAI...');
try {
const response = await openai.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: prompt }],
temperature: 0.4,
});
// TODO(priority=high): improve retry logic for API errors
// TODO(priority=high): improve retry logic for API errors
const result = response.choices[0].message?.content || '';
const match = result.match(/TITLE:\s*(.+?)\s*BODY:\s*([\s\S]*)/i);

Expand All @@ -43,4 +44,9 @@ BODY:

const [, title, body] = match;
return { title: title.trim(), body: body.trim() };
} catch (err: any) {
Copy link

Copilot AI Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating the error type from 'any' to a more precise type (e.g., 'unknown') to improve error safety and clarity.

Copilot uses AI. Check for mistakes.
console.error('[ERROR] OpenAI call failed:', err);
throw err;
}
}