Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
6e084b4a
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "38590da0b1eceb8665ed65716764c38609165958"
Commit
6e084b4a
authored
Jun 22, 2024
by
Timothy J. Baek
Browse files
enh: voice call skip code block & expression
parent
fd96c9c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/lib/utils/index.ts
src/lib/utils/index.ts
+5
-1
No files found.
src/lib/utils/index.ts
View file @
6e084b4a
...
...
@@ -506,12 +506,16 @@ export const removeEmojis = (str) => {
return
str
.
replace
(
emojiRegex
,
''
);
};
export
const
removeFormattings
=
(
str
)
=>
{
return
str
.
replace
(
/
(\*)(
.*
?)\1
/g
,
''
).
replace
(
/
(
```
)(
.*
?)\1
/g
s
,
''
);
};
export
const
extractSentences
=
(
text
)
=>
{
// Split the paragraph into sentences based on common punctuation marks
const
sentences
=
text
.
split
(
/
(?<
=
[
.!?
])\s
+/
);
return
sentences
.
map
((
sentence
)
=>
removeEmojis
(
sentence
.
trim
()))
.
map
((
sentence
)
=>
removeFormattings
(
removeEmojis
(
sentence
.
trim
()))
)
.
filter
((
sentence
)
=>
sentence
!==
''
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment