This commit is contained in:
di-sukharev
2023-05-20 13:07:20 +08:00
parent 52a71728d4
commit 490d209c64
2 changed files with 4 additions and 2 deletions

View File

@@ -74,10 +74,11 @@ async function improveCommitMessagesWithRebase(commits: CommitsArray) {
// send chunks of 3 diffs in parallel, because openAI restricts too many requests at once with 429 error
async function improveMessagesInChunks() {
const chunkSize = improvePromises.length % 2 === 0 ? 4 : 3;
console.log({ chunkSize, improvePromisesLength: improvePromises.length });
let improvedMessagesBySha: MessageBySha = {};
for (let i = 0; i < improvePromises.length; i += chunkSize) {
console.log({ i, improvedMessagesBySha });
const promises = improvePromises.slice(i, i + chunkSize);
console.log({ i, promises, improvedMessagesBySha });
await Promise.all(promises)
.then((results) => {
return results.reduce((acc, improvedMsg, i) => {