AI da dat ten cho dong song

This commit is contained in:
2024-10-26 11:10:14 +07:00
parent 2b6d3869f9
commit 48305a3948
11 changed files with 2999 additions and 63 deletions

View File

@@ -0,0 +1,24 @@
import { Injectable } from '@nestjs/common';
import { OpenAI } from 'openai';
@Injectable()
export class OpenaiService {
constructor(private openai: OpenAI) {}
async generateInvitationMailContent(
mail: string,
username: string,
url: string,
) {
const prompt = `
give me mail content for invitation to a workshop to EPESS and replace {{ mail }} with ${mail}, {{ username }} with ${username} and {{ url }} with ${url}
`;
const response = await this.openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: prompt }],
});
return response.choices[0].message.content;
}
}