mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix: improve international character handling in prompt commands
This commit is contained in:
@@ -1298,3 +1298,17 @@ export const convertOpenApiToToolPayload = (openApiSpec) => {
|
||||
|
||||
return toolPayload;
|
||||
};
|
||||
|
||||
export const slugify = (str: string): string => {
|
||||
return str
|
||||
// 1. Normalize: separate accented letters into base + combining marks
|
||||
.normalize("NFD")
|
||||
// 2. Remove all combining marks (the accents)
|
||||
.replace(/[\u0300-\u036f]/g, "")
|
||||
// 3. Replace any sequence of whitespace with a single hyphen
|
||||
.replace(/\s+/g, "-")
|
||||
// 4. Remove all characters except alphanumeric characters and hyphens
|
||||
.replace(/[^a-zA-Z0-9-]/g, "")
|
||||
// 5. Convert to lowercase
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user