refactor source code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OpenAI } from 'openai';
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { OpenAI } from 'openai'
|
||||
|
||||
@Injectable()
|
||||
export class OpenaiService {
|
||||
@@ -12,13 +12,13 @@ export class OpenaiService {
|
||||
) {
|
||||
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;
|
||||
return response.choices[0].message.content
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user