forked from open-webui/open-webui
feat: # to import doc
This commit is contained in:
parent
2603ac30bc
commit
cc3f84f916
11 changed files with 894 additions and 32 deletions
|
@ -128,6 +128,24 @@ export const findWordIndices = (text) => {
|
|||
return matches;
|
||||
};
|
||||
|
||||
export const removeFirstHashWord = (inputString) => {
|
||||
// Split the string into an array of words
|
||||
const words = inputString.split(' ');
|
||||
|
||||
// Find the index of the first word that starts with #
|
||||
const index = words.findIndex((word) => word.startsWith('#'));
|
||||
|
||||
// Remove the first word with #
|
||||
if (index !== -1) {
|
||||
words.splice(index, 1);
|
||||
}
|
||||
|
||||
// Join the remaining words back into a string
|
||||
const resultString = words.join(' ');
|
||||
|
||||
return resultString;
|
||||
};
|
||||
|
||||
export const calculateSHA256 = async (file) => {
|
||||
// Create a FileReader to read the file asynchronously
|
||||
const reader = new FileReader();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue