Skip to content

Commit 9516ce1

Browse files
committed
fix regex issue
1 parent 46ee595 commit 9516ce1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/embeddings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,5 +251,6 @@ function truncateInputString(input: string | Record<string, string>): string {
251251
}
252252

253253
function trimLeadingSymbols(str: string): string {
254-
return str.replace(/^(?:[\u{1F000}-\u{1F9FF}]|[\u{2600}-\u{27BF}]|[\u{FE00}-\u{FE0F}]|[\u{DFE5}]|\s)+/gu, '');
254+
const regex = /^[\p{S}\p{P}\p{Z}\p{C}\p{Emoji}]+/u;
255+
return str.replace(regex, '');
255256
}

0 commit comments

Comments
 (0)