mirror of
https://git.mirrors.martin98.com/https://github.com/open-webui/open-webui
synced 2025-08-20 02:29:08 +08:00
refac
This commit is contained in:
parent
dea12360f4
commit
9df9f4a990
@ -20,7 +20,9 @@ class ERROR_MESSAGES(str, Enum):
|
|||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return super().__str__()
|
return super().__str__()
|
||||||
|
|
||||||
DEFAULT = lambda err="": f"Something went wrong :/\n[ERROR: {err if err else ''}]"
|
DEFAULT = (
|
||||||
|
lambda err="": f'{"Something went wrong :/" if err == "" else "[ERROR: " + err + "]"}'
|
||||||
|
)
|
||||||
ENV_VAR_NOT_FOUND = "Required environment variable not found. Terminating now."
|
ENV_VAR_NOT_FOUND = "Required environment variable not found. Terminating now."
|
||||||
CREATE_USER_ERROR = "Oops! Something went wrong while creating your account. Please try again later. If the issue persists, contact support for assistance."
|
CREATE_USER_ERROR = "Oops! Something went wrong while creating your account. Please try again later. If the issue persists, contact support for assistance."
|
||||||
DELETE_USER_ERROR = "Oops! Something went wrong. We encountered an issue while trying to delete the user. Please give it another shot."
|
DELETE_USER_ERROR = "Oops! Something went wrong. We encountered an issue while trying to delete the user. Please give it another shot."
|
||||||
|
@ -99,13 +99,18 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.toLowerCase() in folders) {
|
if (Object.values(folders).find((folder) => folder.name.toLowerCase() === name.toLowerCase())) {
|
||||||
// If a folder with the same name already exists, append a number to the name
|
// If a folder with the same name already exists, append a number to the name
|
||||||
let i = 1;
|
let i = 1;
|
||||||
while (name.toLowerCase() + ` ${i}` in folders) {
|
while (
|
||||||
|
Object.values(folders).find(
|
||||||
|
(folder) => folder.name.toLowerCase() === `${name} ${i}`.toLowerCase()
|
||||||
|
)
|
||||||
|
) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
name = name + ` ${i}`;
|
|
||||||
|
name = `${name} ${i}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await createNewFolder(localStorage.token, name).catch((error) => {
|
const res = await createNewFolder(localStorage.token, name).catch((error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user