Fix critical bugs
This commit is contained in:
@@ -73,7 +73,7 @@ filterwarnings = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
"FIRESTORE_EMULATOR_HOST=[::1]:8911",
|
"FIRESTORE_EMULATOR_HOST=[::1]:8469",
|
||||||
"GCP_PROJECT_ID=test-project",
|
"GCP_PROJECT_ID=test-project",
|
||||||
"GCP_LOCATION=us-central1",
|
"GCP_LOCATION=us-central1",
|
||||||
"GCP_FIRESTORE_DATABASE_ID=(default)",
|
"GCP_FIRESTORE_DATABASE_ID=(default)",
|
||||||
|
|||||||
@@ -370,12 +370,13 @@ class ConversationManagerService:
|
|||||||
logger.info("Matched quick reply: %s", pregunta.titulo)
|
logger.info("Matched quick reply: %s", pregunta.titulo)
|
||||||
break
|
break
|
||||||
|
|
||||||
# If no match, use first question as default or delegate to normal flow
|
# If no match, delegate to normal flow
|
||||||
if not matched_answer:
|
if not matched_answer:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"No matching quick reply found for message: '%s'.",
|
"No matching quick reply found for message: '%s'. Falling back to RAG.",
|
||||||
request.mensaje,
|
request.mensaje,
|
||||||
)
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
# Create response with the matched quick reply answer
|
# Create response with the matched quick reply answer
|
||||||
return DetectIntentResponse(
|
return DetectIntentResponse(
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
PREFIX_PO_PARAM = "notification_po_"
|
PREFIX_PO_PARAM = "notification_po_"
|
||||||
|
|
||||||
|
# Keep references to background tasks to prevent garbage collection
|
||||||
|
_background_tasks: set[asyncio.Task] = set()
|
||||||
|
|
||||||
|
|
||||||
class NotificationManagerService:
|
class NotificationManagerService:
|
||||||
"""Manages notification processing and integration with conversations.
|
"""Manages notification processing and integration with conversations.
|
||||||
@@ -127,6 +130,8 @@ class NotificationManagerService:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Fire and forget - don't await
|
# Fire and forget - don't await
|
||||||
_task = asyncio.create_task(save_notification_to_firestore())
|
task = asyncio.create_task(save_notification_to_firestore())
|
||||||
# Store reference to prevent premature garbage collection
|
# Store reference to prevent premature garbage collection
|
||||||
del _task
|
_background_tasks.add(task)
|
||||||
|
# Remove from set when done to prevent memory leak
|
||||||
|
task.add_done_callback(_background_tasks.discard)
|
||||||
|
|||||||
Reference in New Issue
Block a user