async function translate()

in eng/copilot/testTranslation.js [65:91]


async function translate(file, sessionId, accessToken, targetLanguage) {
    const query = `
                Below is a file change patch from github pull request.
                Go through this file name and file patch then translate the file content to ${targetLanguage}.
                Return the response in stringfied json format, with fileName and fileContent.
                The file name should begin with path tests/integration-tests/${targetLanguage}
                For your response, use same environment variable(hub, connection string, messages etc.) as the original file.
                Do not omit any file content. The response should contain as many tests as the original document.

                Include these import statement as necessary in your response:
                ###
                ${prompt[targetLanguage]}
                ###
                File name: ###${file.filename}###
                File patch:###${file.patch}###`;
    try {
        while (true) {
            const dpResponse = await fetchDeepPromptWithQuery(query, sessionId, accessToken);
            if (dpResponse && dpResponse.includes("fileName") && dpResponse.includes("fileContent")) {
                return parseResponseToJson(dpResponse.response_text);
            }
        }
    } catch (error) {
        console.error("Failed to fetch deep prompt rest api, ", error.message);
        throw error;
    }
}