From e4b8efc6ce3d7e5ba1cd6e41500768f786cf9571 Mon Sep 17 00:00:00 2001 From: Brendan Quinn Date: Mon, 5 Feb 2024 21:33:40 +0000 Subject: [PATCH] Temporarily removes full_text from vector searches --- chat/src/event_config.py | 2 +- chat/src/handlers/chat.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/chat/src/event_config.py b/chat/src/event_config.py index 7590c842..5c7762b3 100644 --- a/chat/src/event_config.py +++ b/chat/src/event_config.py @@ -122,7 +122,7 @@ def _get_attributes(self): attributes = [ item for item in self._get_request_attributes() - if item not in [self._get_text_key(), "source"] + if item not in [self._get_text_key(), "source", "full_text"] ] return attributes diff --git a/chat/src/handlers/chat.py b/chat/src/handlers/chat.py index 46b53b99..aa19ff79 100644 --- a/chat/src/handlers/chat.py +++ b/chat/src/handlers/chat.py @@ -2,7 +2,6 @@ from event_config import EventConfig from helpers.response import prepare_response - def handler(event, _context): try: config = EventConfig(event) @@ -21,5 +20,10 @@ def handler(event, _context): final_response = prepare_response(config) config.socket.send(final_response) return {"statusCode": 200} + except Exception as err: - raise err \ No newline at end of file + if err.__class__.__name__ == "PayloadTooLargeException": + config.socket.send({"type": "error", "message": "Payload too large"}) + return {"statusCode": 413, "body": "Payload too large"} + else: + raise err