* Create a prompt for the OpenAI API * @param task Task description * @param files Files to process * @returns Prompt text
(task: string, files: FileToProcess[])
| 263 | * @returns Prompt text |
| 264 | */ |
| 265 | private createPrompt(task: string, files: FileToProcess[]): string { |
| 266 | let prompt = `Task: ${task}\n\n`; |
| 267 | prompt += "Files to analyze and modify:\n\n"; |
| 268 | |
| 269 | for (const file of files) { |
| 270 | prompt += `File: ${file.path}\n\`\`\`\n${file.originalContent}\n\`\`\`\n\n`; |
| 271 | } |
| 272 | |
| 273 | prompt += |
| 274 | "Please analyze the code and suggest improvements. For each file you want to modify, provide the full updated code in the following format:\n\n"; |
| 275 | prompt += "Analysis:\n[Your analysis here]\n\n"; |
| 276 | prompt += "Plan:\n[Your plan here]\n\n"; |
| 277 | prompt += "File: [file path]\n```[language]\n[full updated code]\n```\n"; |
| 278 | |
| 279 | return prompt; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Process the response from the OpenAI API |