async function fixErrorWithDP()

in eng/copilot/fixErrorWithDeepPrompt.js [33:52]


async function fixErrorWithDP(file, errorMessage, sessionId, accessToken) {
    const query = `
                Below is a file change patch from git hub pull request, it failed to pass the ci test.
                Base on the error message, rewrite the code of this file to fix the error.
                Return the respinses in stringfied json format with fileName and fileContent.
                file name: ###${file.filename}###
                file dispatch: ###${file.patch}###
                error message: ###${errorMessage}###`;
    try {
        while (true) {
            const dpResponse = await fetchDeepPromptWithQuery(query, sessionId, accessToken);
            if (dpResponse && dpResponse.includes("fileName") && dpResponse.includes("fileContent")) {
                return parseResponseToJson(dpResponse);
            }
        }

    } catch (err) {
        console.error("Failed to fetch deep prompt rest api:", err.message);
    }
}