feat: enhance document processing with AI suggestions and preview image support

- Added AI_SUGGESTION event to DocumentEvent enum for improved document interaction.
- Implemented updateDocumentPreviewImage mutation in DocumentSchema to allow updating of document preview images.
- Integrated grammar checking functionality in DocumentService, utilizing OpenAI for real-time suggestions and caching results in Redis.
- Enhanced MinioService with methods for file upsert and document content retrieval.
- Updated PrismaTypes to include new relations and fields for better data structure alignment.
- Commented out unused RESTful service methods for future cleanup.

These changes improve the document editing experience by leveraging AI capabilities and enhancing the schema for better data management.
This commit is contained in:
2024-12-10 23:27:05 +07:00
parent e1cfd55502
commit 9500471faf
10 changed files with 306 additions and 174 deletions

View File

@@ -17,6 +17,9 @@ export class RedisService {
async set(key: string, value: string, expireAt: number) {
return await this.redis.set(key, value, 'EXAT', expireAt)
}
async setPermanent(key: string, value: string) {
return await this.redis.set(key, value)
}
async del(key: string) {
return await this.redis.del(key)
@@ -38,4 +41,20 @@ export class RedisService {
async setUser(sessionId: string, user: User, expireAt: number) {
return await this.set(sessionId, JSON.stringify(user), expireAt)
}
async rpush(key: string, value: string) {
return await this.redis.rpush(key, value)
}
async lrange(key: string, start: number, end: number) {
return await this.redis.lrange(key, start, end)
}
async blpop(key: string, timeout: number) {
return await this.redis.blpop(key, timeout)
}
async publish(channel: string, message: string) {
return await this.redis.publish(channel, message)
}
}