fix(core): update
This commit is contained in:
		@@ -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;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user