From 0f54d94da1102b4dd63a039daca3e8a3b48ac48e Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 11 Dec 2024 13:57:05 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(backend)=20fix=20sanitize=20proble?= =?UTF-8?q?m=20IA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Albert send us back a malformed IA json, the sanitize function was not able to handle it correctly. We add a try catch on it, to not use the sanitizer if the json.loads fails. --- CHANGELOG.md | 6 +++++- src/backend/core/services/ai_services.py | 10 ++++++--- .../core/tests/test_services_ai_services.py | 21 +++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb7ab7cf50..bfb88657b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,11 +18,15 @@ and this project adheres to - 🔒️(collaboration) increase collaboration access security #472 - 🔨(frontend) encapsulated title to its own component #474 -- 🐛(frontend) Fix hidden menu on Firefox #468 - ⚡️(backend) optimize number of queries on document list view #411 - ♻️(frontend) stop to use provider with version #480 - 🚚(collaboration) change the websocket key name #480 +## Fixed + +- 🐛(frontend) Fix hidden menu on Firefox #468 +- 🐛(backend) fix sanitize problem IA #490 + ## [1.8.2] - 2024-11-28 diff --git a/src/backend/core/services/ai_services.py b/src/backend/core/services/ai_services.py index b7c70405c3..6c0f92abef 100644 --- a/src/backend/core/services/ai_services.py +++ b/src/backend/core/services/ai_services.py @@ -67,10 +67,14 @@ def call_ai_api(self, system_content, text): ) content = response.choices[0].message.content - sanitized_content = re.sub(r"(?