fix(core): update

This commit is contained in:
Philipp Kunz 2024-05-17 17:38:35 +02:00
parent be53225bb1
commit 32f12c67cf
6 changed files with 4910 additions and 2946 deletions

View File

@ -17,24 +17,24 @@
"build": "(tsbuild --web --allowimplicitany)"
},
"devDependencies": {
"@git.zone/tsbuild": "^2.1.65",
"@git.zone/tsbuild": "^2.1.76",
"@git.zone/tsrun": "^1.2.46",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.12.7"
"@types/node": "^20.12.12"
},
"dependencies": {
"@push.rocks/early": "^4.0.3",
"@push.rocks/npmextra": "^5.0.13",
"@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartai": "^0.0.8",
"@push.rocks/smartai": "^0.0.17",
"@push.rocks/smartcli": "^4.0.10",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^11.0.14",
"@push.rocks/smartinteract": "^2.0.15",
"@push.rocks/smartlog": "^3.0.1",
"@push.rocks/smartlog-destination-local": "^9.0.1",
"@push.rocks/smartpath": "^5.0.16",
"@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartshell": "^3.0.5",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tsdoc',
version: '1.1.27',
version: '1.1.28',
description: 'An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.'
}

View File

@ -8,7 +8,6 @@ interface IDescriptionInterface {
}
export class Description {
// INSTANCE
private aiDocsRef: AiDoc;
private projectDir: string;
@ -23,30 +22,32 @@ export class Description {
const projectContext = new ProjectContext(this.projectDir);
const contextString = await projectContext.update();
let result = await this.aiDocsRef.openaiInstance.chat(
`
You create a json adhering the following interface:
{
description: string; // a sensible short, one sentence description of the project
keywords: string[]; // an array of tags that describe the project
}
let result = await this.aiDocsRef.openaiInstance.chat({
systemMessage: `
You create a json adhering the following interface:
{
description: string; // a sensible short, one sentence description of the project
keywords: string[]; // an array of tags that describe the project
}
The description should be based on what you understand from the project's files.
The keywords should be based on use cases you see from the files.
Don't be cheap about the way you think.
The description should be based on what you understand from the project's files.
The keywords should be based on use cases you see from the files.
Don't be cheap about the way you think.
Important: Answer only in valid JSON.
You answer should be parseable with JSON.parse() without modifying anything.
Important: Answer only in valid JSON.
You answer should be parseable with JSON.parse() without modifying anything.
Don't wrap the JSON in three ticks json!!!
`,
contextString,
[]
Don't wrap the JSON in three ticks json!!!
`,
messageHistory: [],
userMessage: contextString,
});
console.log(result.message);
const resultObject: IDescriptionInterface = JSON.parse(
result.message.replace('```json', '').replace('```', '')
);
console.log(result.message.content);
const resultObject: IDescriptionInterface = JSON.parse(result.message.content.replace('```json', '').replace('```', ''));
const npmextraJson = (await projectContext.gatherFiles()).smartfilesNpmextraJSON;
const npmextraJsonContent = JSON.parse(npmextraJson.contents.toString());
@ -64,10 +65,9 @@ export class Description {
packageJson.contents = Buffer.from(JSON.stringify(packageJsonContent, null, 2));
await packageJson.write();
console.log(`\n======================\n`);
console.log(JSON.stringify(resultObject, null, 2));
console.log(`\n======================\n`);
return result.message.content;
return result.message;
}
}
}

View File

@ -28,8 +28,8 @@ export class Readme {
console.log(error);
}
let result = await this.aiDocsRef.openaiInstance.chat(
`
let result = await this.aiDocsRef.openaiInstance.chat({
systemMessage: `
You create markdown readmes for npm projects. You only output the markdown readme.
The Readme should follow the following template:
@ -63,24 +63,24 @@ The Readme should follow the following template:
* npmextra.json contains overall module information.
* readme.hints.md provides valuable hints about module ideas.
]
`,
contextString,
[]
);
`,
messageHistory: [],
userMessage: contextString,
});
finalReadmeString += result.message.content + '\n' + legalInfo;
finalReadmeString += result.message + '\n' + legalInfo;
console.log(`\n======================\n`);
console.log(result.message.content);
console.log(result.message);
console.log(`\n======================\n`);
const readme = (await projectContext.gatherFiles()).smartfilesReadme;
readme.contents = Buffer.from(finalReadmeString);
await readme.write();
return result.message.content;
return result.message;
}
}

View File

@ -69,7 +69,9 @@ export class AiDoc {
}
// lets assume we have an OPENAI_Token now
this.openaiInstance = new plugins.smartai.OpenAiProvider(this.openaiToken);
this.openaiInstance = new plugins.smartai.OpenAiProvider({
openaiToken: this.openaiToken,
});
await this.openaiInstance.start();
}