From 308a26b9d8ec4805cdf2cc89f9a53972704b5622 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 4 Dec 2024 11:39:17 +0700 Subject: [PATCH] fix: 4208 - Empty title with special characters --- web/containers/Providers/ModelHandler.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/containers/Providers/ModelHandler.tsx b/web/containers/Providers/ModelHandler.tsx index b36f413b9b..373c0aebd6 100644 --- a/web/containers/Providers/ModelHandler.tsx +++ b/web/containers/Providers/ModelHandler.tsx @@ -134,7 +134,7 @@ export default function ModelHandler() { // Remove non-alphanumeric characters const cleanedMessageContent = messageContent - .replace(/[^a-z0-9\s]/gi, '') + .replace(/[^\p{L}\s]+/gu, '') .trim() // Split the message into words @@ -147,6 +147,9 @@ export default function ModelHandler() { return } + // Do not persist empty message + if (!cleanedMessageContent.trim().length) return + const updatedThread: Thread = { ...thread,