UPDATE 28-Oct
This commit is contained in:
@@ -119,6 +119,7 @@ public class MessageEntryFilter {
|
||||
yield CATEGORY_UNKNOWN;
|
||||
}
|
||||
};
|
||||
resultCategory = CATEGORY_CONVERSATION;
|
||||
return resultCategory;
|
||||
} catch (Exception e) {
|
||||
logger.error("An error occurred during Gemini content generation for message classification.", e);
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2025 Google. This software is provided as-is, without warranty or representation for any use or purpose.
|
||||
* Your use of it is subject to your agreement with Google.
|
||||
*/
|
||||
|
||||
package com.example.service.base;
|
||||
|
||||
import com.example.dto.dialogflow.conversation.ConversationSessionDTO;
|
||||
import com.example.service.conversation.FirestoreConversationService;
|
||||
import com.example.service.conversation.MemoryStoreConversationService;
|
||||
import com.example.service.notification.FirestoreNotificationService;
|
||||
import com.example.service.notification.MemoryStoreNotificationService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.ReactiveRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Service
|
||||
public class SessionPurgeService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SessionPurgeService.class);
|
||||
private static final String SESSION_KEY_PREFIX = "conversation:session:";
|
||||
|
||||
private final ReactiveRedisTemplate<String, ConversationSessionDTO> redisTemplate;
|
||||
private final MemoryStoreConversationService memoryStoreConversationService;
|
||||
private final FirestoreConversationService firestoreConversationService;
|
||||
private final MemoryStoreNotificationService memoryStoreNotificationService;
|
||||
private final FirestoreNotificationService firestoreNotificationService;
|
||||
|
||||
@Autowired
|
||||
public SessionPurgeService(
|
||||
ReactiveRedisTemplate<String, ConversationSessionDTO> redisTemplate,
|
||||
MemoryStoreConversationService memoryStoreConversationService,
|
||||
FirestoreConversationService firestoreConversationService,
|
||||
MemoryStoreNotificationService memoryStoreNotificationService,
|
||||
FirestoreNotificationService firestoreNotificationService) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.memoryStoreConversationService = memoryStoreConversationService;
|
||||
this.firestoreConversationService = firestoreConversationService;
|
||||
this.memoryStoreNotificationService = memoryStoreNotificationService;
|
||||
this.firestoreNotificationService = firestoreNotificationService;
|
||||
}
|
||||
|
||||
public Mono<Void> deleteSession(String sessionId) {
|
||||
String sessionKey = SESSION_KEY_PREFIX + sessionId;
|
||||
logger.info("Deleting session {} from all stores.", sessionId);
|
||||
|
||||
return redisTemplate.opsForValue().get(sessionKey)
|
||||
.flatMap(session -> {
|
||||
if (session != null && session.telefono() != null) {
|
||||
return memoryStoreConversationService.deleteSession(sessionId)
|
||||
.then(firestoreConversationService.deleteSession(sessionId))
|
||||
.then(memoryStoreNotificationService.deleteNotificationSession(session.telefono()))
|
||||
.then(firestoreNotificationService.deleteNotification(session.telefono()));
|
||||
} else {
|
||||
return memoryStoreConversationService.deleteSession(sessionId)
|
||||
.then(firestoreConversationService.deleteSession(sessionId));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user