prettier fixes #16
This commit is contained in:
@@ -16,17 +16,19 @@ export default class NotesService {
|
||||
return prisma_client.note.findMany({ where: { account_id } });
|
||||
}
|
||||
|
||||
async createNote( account_id: number, note_text: string ) {
|
||||
async createNote(account_id: number, note_text: string) {
|
||||
const account = await prisma_client.account.findFirstOrThrow({
|
||||
where: { id: account_id},
|
||||
include: { notes: true}
|
||||
where: { id: account_id },
|
||||
include: { notes: true }
|
||||
});
|
||||
|
||||
if(account.notes.length>= account.max_notes){
|
||||
throw new AccountLimitError('Note Limit reached, no new notes can be added');
|
||||
if (account.notes.length >= account.max_notes) {
|
||||
throw new AccountLimitError(
|
||||
'Note Limit reached, no new notes can be added'
|
||||
);
|
||||
}
|
||||
|
||||
return prisma_client.note.create({ data: { account_id, note_text }});
|
||||
|
||||
return prisma_client.note.create({ data: { account_id, note_text } });
|
||||
}
|
||||
|
||||
async updateNote(id: number, note_text: string) {
|
||||
@@ -44,14 +46,14 @@ export default class NotesService {
|
||||
const prompt = `
|
||||
Write an interesting short note about ${userPrompt}.
|
||||
Restrict the note to a single paragraph.
|
||||
`
|
||||
`;
|
||||
const completion = await openai.createCompletion({
|
||||
model: "text-davinci-003",
|
||||
model: 'text-davinci-003',
|
||||
prompt,
|
||||
temperature: 0.6,
|
||||
stop: "\n\n",
|
||||
stop: '\n\n',
|
||||
max_tokens: 1000,
|
||||
n: 1,
|
||||
n: 1
|
||||
});
|
||||
|
||||
await accountService.incrementAIGenCount(account);
|
||||
|
||||
Reference in New Issue
Block a user