Refactor CollaborationSession and Document schemas to improve code clarity and functionality. Enhance error handling in collaboration session retrieval and update logic. Introduce new request sync events in Document schema and update Minio service for document page management. Adjust cron job to use current date for future schedule date checks. Update user schema for better error handling and improve service descriptions in order schema. Remove global decorators from Workshop modules for better module encapsulation.
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { OpenAI } from 'openai'
|
||||
import { DocumentDelta } from 'src/Document/document.type'
|
||||
|
||||
@Injectable()
|
||||
export class OpenaiService {
|
||||
constructor(private openai: OpenAI) {}
|
||||
|
||||
async generateInvitationMailContent(
|
||||
mail: string,
|
||||
username: string,
|
||||
url: string,
|
||||
) {
|
||||
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}
|
||||
`
|
||||
@@ -21,4 +18,17 @@ export class OpenaiService {
|
||||
|
||||
return response.choices[0].message.content
|
||||
}
|
||||
|
||||
async documentSuggestEditDelta(documentDelta: DocumentDelta): Promise<DocumentDelta> {
|
||||
const prompt = `
|
||||
give me suggestion for edit document delta to EPESS and replace {{ documentDelta }} with ${documentDelta}
|
||||
`
|
||||
|
||||
const response = await this.openai.chat.completions.create({
|
||||
model: 'gpt-4o',
|
||||
messages: [{ role: 'user', content: prompt }],
|
||||
})
|
||||
|
||||
return response.choices[0].message.content as unknown as DocumentDelta
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user