From 09ba87a6748cc3c30cace3561598ef82db43782e Mon Sep 17 00:00:00 2001 From: mdciri Date: Tue, 5 Nov 2024 14:32:15 +0100 Subject: [PATCH] Update to mask_pii method to mask only the response content and not the reference links --- apps/chatbot/src/modules/chatbot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/chatbot/src/modules/chatbot.py b/apps/chatbot/src/modules/chatbot.py index f9ffa44ba..4b715b7e9 100644 --- a/apps/chatbot/src/modules/chatbot.py +++ b/apps/chatbot/src/modules/chatbot.py @@ -127,7 +127,11 @@ def _unmask_reference(self, response_str: str, nodes) -> str: def mask_pii(self, message: str) -> str: if USE_PRESIDIO: try: - return self.pii.mask_pii(message) + split_message = message.split("Rif:") + masked_message = self.pii.mask_pii(split_message[0]) + if len(split_message)>1: + masked_message = masked_message + "Rif:" + split_message[1] + return masked_message except Exception as e: logging.warning(f"[chatbot.py - mask_pii] exception in mask_pii: {e}") else: