Update dependencies in package.json and package-lock.json, refactor CronService to include notification handling for schedule expirations, and enhance DocumentSchema with OpenAI integration for document editing suggestions. Additionally, modify GraphqlModule to include PubSubModule for real-time notifications and improve datetime utility functions for better date formatting. Update epess-database subproject reference to indicate a dirty state.

This commit is contained in:
2024-11-30 16:41:47 +07:00
parent 7cff5069de
commit a619c95efc
17 changed files with 971 additions and 863 deletions

View File

@@ -7,12 +7,14 @@ import { Document } from '@prisma/client'
import { DocumentDelta } from './document.type'
import Delta from 'quill-delta'
import { MinioService } from 'src/Minio/minio.service'
import { OpenaiService } from 'src/OpenAI/openai.service'
@Injectable()
export class DocumentSchema extends PothosSchema {
constructor(
@Inject(SchemaBuilderToken) private readonly builder: Builder,
private readonly prisma: PrismaService,
private readonly minio: MinioService,
private readonly openaiService: OpenaiService,
) {
super()
}
@@ -237,6 +239,18 @@ export class DocumentSchema extends PothosSchema {
},
}),
testSuggestEditDocument: t.field({
type: 'Delta',
args: {
documentDelta: t.arg({ type: this.documentDeltaInput(), required: true }),
},
resolve: async (_root, args, ctx: SchemaContext) => {
if (ctx.isSubscription) throw new Error('Not allowed')
if (!args.documentDelta.delta) throw new Error('Delta not found')
return await this.openaiService.documentSuggestEditDelta(args.documentDelta.delta)
},
}),
eventDocumentChanged: t.field({
type: this.documentDelta(),
args: {