* Parse Bedrock response to extract comment text
(responseBody: string)
| 193 | * Parse Bedrock response to extract comment text |
| 194 | */ |
| 195 | function parseCommentResponse(responseBody: string): string { |
| 196 | try { |
| 197 | const parsed = JSON.parse(responseBody); |
| 198 | |
| 199 | if (parsed.content && Array.isArray(parsed.content)) { |
| 200 | const textContent = parsed.content.find((c: any) => c.type === "text"); |
| 201 | if (textContent && textContent.text) { |
| 202 | return textContent.text.trim(); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | throw new Error("Unable to parse response content"); |
| 207 | } catch (error) { |
| 208 | console.error("Error parsing Bedrock response:", error); |
| 209 | throw error; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Generate acknowledgment comment using Bedrock Claude Opus 4.6 |
no outgoing calls
no test coverage detected