feat: resolve conflict

This commit is contained in:
GitPusher99
2024-03-28 15:48:16 +08:00
8 changed files with 3971 additions and 143 deletions
+8 -8
View File
@@ -119,8 +119,8 @@ class SunoApi {
const startTime = Date.now();
const audios = this.generateSongs(prompt, false, undefined, undefined, make_instrumental, wait_audio);
const costTime = Date.now() - startTime;
logger.info("Generate Response:\n", JSON.stringify(audios, null, 2));
logger.info("Cost time: ", costTime);
logger.info("Generate Response:\n" + JSON.stringify(audios, null, 2));
logger.info("Cost time: " + costTime);
return audios;
}
@@ -144,8 +144,8 @@ class SunoApi {
const startTime = Date.now();
const audios = await this.generateSongs(prompt, true, tags, title, make_instrumental, wait_audio);
const costTime = Date.now() - startTime;
logger.info("Custom Generate Response:\n", JSON.stringify(audios, null, 2));
logger.info("Cost time: ", costTime);
logger.info("Custom Generate Response:\n" + JSON.stringify(audios, null, 2));
logger.info("Cost time: " + costTime);
return audios;
}
@@ -181,7 +181,7 @@ class SunoApi {
} else {
payload.gpt_description_prompt = prompt;
}
logger.info("generateSongs payload:\n", {
logger.info("generateSongs payload:\n" + JSON.stringify({
prompt: prompt,
isCustom: isCustom,
tags: tags,
@@ -189,7 +189,7 @@ class SunoApi {
make_instrumental: make_instrumental,
wait_audio: wait_audio,
payload: payload,
});
}, null, 2));
const response = await this.client.post(
`${SunoApi.BASE_URL}/api/generate/v2/`,
payload,
@@ -197,7 +197,7 @@ class SunoApi {
timeout: 10000, // 10 seconds timeout
},
);
logger.info("generateSongs Response:\n", JSON.stringify(response.data, null, 2));
logger.info("generateSongs Response:\n" + JSON.stringify(response.data, null, 2));
if (response.status !== 200) {
throw new Error("Error response:" + response.statusText);
}
@@ -273,7 +273,7 @@ class SunoApi {
if (songIds) {
url = `${url}?ids=${songIds.join(',')}`;
}
logger.info("Get audio status: ", url);
logger.info("Get audio status: " + url);
const response = await this.client.get(url, {
// 3 seconds timeout
timeout: 3000