Skip to content

Commit

Permalink
Merge pull request #4212 from janhq/fix/4208-should-not-filter-out-sp…
Browse files Browse the repository at this point in the history
…ecial-chars-on-title-update

fix: 4208 - Empty title with special characters
  • Loading branch information
louis-jan authored Dec 4, 2024
2 parents 6557d64 + 308a26b commit 9c5a6e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/containers/Providers/ModelHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -147,6 +147,9 @@ export default function ModelHandler() {
return
}

// Do not persist empty message
if (!cleanedMessageContent.trim().length) return

const updatedThread: Thread = {
...thread,

Expand Down

0 comments on commit 9c5a6e2

Please sign in to comment.