Fix type errors
This commit is contained in:
@@ -84,16 +84,16 @@ class ConversationManagerService:
|
||||
await self.redis_service.save_session(session)
|
||||
|
||||
# Step 2: Check for pantallaContexto in existing session
|
||||
if session.pantallaContexto:
|
||||
if session.pantalla_contexto:
|
||||
# Check if pantallaContexto is stale (10 minutes)
|
||||
if self._is_pantalla_context_valid(session.last_modified):
|
||||
logger.info(
|
||||
"Detected 'pantallaContexto' in session: %s. "
|
||||
"Delegating to QuickReplies flow.",
|
||||
session.pantallaContexto,
|
||||
session.pantalla_contexto,
|
||||
)
|
||||
response = await self._manage_quick_reply_conversation(
|
||||
request, session.pantallaContexto,
|
||||
request, session.pantalla_contexto,
|
||||
)
|
||||
if response:
|
||||
# Save user message to Firestore
|
||||
@@ -214,9 +214,9 @@ class ConversationManagerService:
|
||||
|
||||
# Step 3i: Return response object
|
||||
return DetectIntentResponse(
|
||||
response_id=str(uuid4()),
|
||||
query_result=QueryResult(
|
||||
response_text=assistant_response,
|
||||
responseId=str(uuid4()),
|
||||
queryResult=QueryResult(
|
||||
responseText=assistant_response,
|
||||
parameters=None,
|
||||
),
|
||||
quick_replies=None,
|
||||
@@ -265,8 +265,8 @@ class ConversationManagerService:
|
||||
|
||||
# Create response with the matched quick reply answer
|
||||
return DetectIntentResponse(
|
||||
response_id=str(uuid4()),
|
||||
query_result=QueryResult(response_text=matched_answer, parameters=None),
|
||||
responseId=str(uuid4()),
|
||||
queryResult=QueryResult(responseText=matched_answer, parameters=None),
|
||||
quick_replies=quick_reply_screen,
|
||||
)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class FirestoreService:
|
||||
self.db.close()
|
||||
logger.info("Firestore client closed")
|
||||
|
||||
def _session_ref(self, session_id: str) -> firestore.DocumentReference:
|
||||
def _session_ref(self, session_id: str) -> firestore.AsyncDocumentReference:
|
||||
"""Get Firestore document reference for session."""
|
||||
return self.db.collection(self.conversations_collection).document(session_id)
|
||||
|
||||
@@ -284,7 +284,9 @@ class FirestoreService:
|
||||
|
||||
# ====== Notification Methods ======
|
||||
|
||||
def _notification_ref(self, notification_id: str) -> firestore.DocumentReference:
|
||||
def _notification_ref(
|
||||
self, notification_id: str,
|
||||
) -> firestore.AsyncDocumentReference:
|
||||
"""Get Firestore document reference for notification."""
|
||||
return self.db.collection(self.notifications_collection).document(
|
||||
notification_id,
|
||||
@@ -370,6 +372,12 @@ class FirestoreService:
|
||||
return
|
||||
|
||||
session_data = doc.to_dict()
|
||||
if not session_data:
|
||||
logger.warning(
|
||||
"Notification session %s has no data in Firestore",
|
||||
session_id,
|
||||
)
|
||||
return
|
||||
notifications = session_data.get("notificaciones", [])
|
||||
|
||||
# Update status for all notifications
|
||||
|
||||
@@ -291,10 +291,10 @@ class RedisService:
|
||||
else:
|
||||
# Create new session
|
||||
updated_session = NotificationSession(
|
||||
session_id=notification_session_id,
|
||||
sessionId=notification_session_id,
|
||||
telefono=phone_number,
|
||||
fecha_creacion=datetime.now(UTC),
|
||||
ultima_actualizacion=datetime.now(UTC),
|
||||
fechaCreacion=datetime.now(UTC),
|
||||
ultimaActualizacion=datetime.now(UTC),
|
||||
notificaciones=[new_entry],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user