( owner: string, repo: string, issueNumber: number, issueTitle: string, issueBody: string, classification: ClassificationResult, githubToken: string )
| 214 | * Generate acknowledgment comment using Bedrock Claude Opus 4.6 |
| 215 | */ |
| 216 | export async function generateAcknowledgmentComment( |
| 217 | owner: string, |
| 218 | repo: string, |
| 219 | issueNumber: number, |
| 220 | issueTitle: string, |
| 221 | issueBody: string, |
| 222 | classification: ClassificationResult, |
| 223 | githubToken: string |
| 224 | ): Promise<string> { |
| 225 | // Sanitize and truncate inputs |
| 226 | const sanitizedTitle = issueTitle.substring(0, MAX_TITLE_LENGTH); |
| 227 | const sanitizedBody = issueBody.substring(0, MAX_BODY_LENGTH); |
| 228 | const labels = classification.recommended_labels.join(", ") || "pending-triage"; |
| 229 | |
| 230 | // Fetch existing comments |
| 231 | const issueComments = await fetchIssueComments(owner, repo, issueNumber, githubToken); |
| 232 | |
| 233 | const client = createBedrockClient(); |
| 234 | const prompt = buildCommentPrompt(sanitizedTitle, sanitizedBody, issueComments, labels); |
| 235 | |
| 236 | try { |
| 237 | const responseBody = await invokeBedrockWithFallback(client, prompt); |
| 238 | return parseCommentResponse(responseBody); |
| 239 | } catch (error) { |
| 240 | console.error("Error generating acknowledgment comment with Bedrock:", error); |
| 241 | throw error; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Get fallback comment when Bedrock fails |
no test coverage detected