fix(aidocs_classes): Fix minor bugs and update dependencies in aidocs_classes

This commit is contained in:
2024-06-23 22:47:27 +02:00
parent 5e2171dbfd
commit 34102a2544
6 changed files with 39 additions and 28 deletions

View File

@@ -72,8 +72,6 @@ Also you are given a diff
result.message.replace('```json', '').replace('```', '')
);
// lets build the changelog based on that
const commitMessages = await gitRepo.getAllCommitMessages();
const previousChangelogPath = plugins.path.join(this.projectDir, 'changelog.md');
let previousChangelog: plugins.smartfile.SmartFile;
if (await plugins.smartfile.fs.fileExists(previousChangelogPath)) {
@@ -81,6 +79,8 @@ Also you are given a diff
}
if (!previousChangelog) {
// lets build the changelog based on that
const commitMessages = await gitRepo.getAllCommitMessages();
let result2 = await this.aiDocsRef.openaiInstance.chat({
messageHistory: [],
systemMessage: `
@@ -100,17 +100,20 @@ Only return the changelog file, so it can be written directly to changelog.md`,
userMessage: `
Here are the commit messages:
${commitMessages.join('\n')}
${JSON.stringify(commitMessages, null, 2)}
`,
});
previousChangelog = await plugins.smartfile.SmartFile.fromString(previousChangelogPath, result2.message, 'utf8');
previousChangelog = await plugins.smartfile.SmartFile.fromString(
previousChangelogPath,
result2.message,
'utf8'
);
}
let oldChangelog = previousChangelog.contents.toString().replace('# Changelog\n\n', '');
let newDateString = new plugins.smarttime.ExtendedDate().exportToHyphedSortableDate();
let newChangelog = `# Changelog\n\n${
`## ${newDateString} - {{nextVersion}} - {{nextVersionScope}}
let newChangelog = `# Changelog\n\n${`## ${newDateString} - {{nextVersion}} - {{nextVersionScope}}
{{nextVersionMessage}}
{{nextVersionDetails}}
`}\n\n${oldChangelog}\n`;