mirror of
https://git.mirrors.martin98.com/https://github.com/open-webui/open-webui
synced 2025-08-16 06:45:59 +08:00
refac: toast error
This commit is contained in:
parent
af48f346f1
commit
a863f98c53
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
const shareHandler = async (func) => {
|
const shareHandler = async (func) => {
|
||||||
const item = await getFunctionById(localStorage.token, func.id).catch((error) => {
|
const item = await getFunctionById(localStorage.token, func.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
const cloneHandler = async (func) => {
|
const cloneHandler = async (func) => {
|
||||||
const _function = await getFunctionById(localStorage.token, func.id).catch((error) => {
|
const _function = await getFunctionById(localStorage.token, func.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
const exportHandler = async (func) => {
|
const exportHandler = async (func) => {
|
||||||
const _function = await getFunctionById(localStorage.token, func.id).catch((error) => {
|
const _function = await getFunctionById(localStorage.token, func.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
const deleteHandler = async (func) => {
|
const deleteHandler = async (func) => {
|
||||||
const res = await deleteFunctionById(localStorage.token, func.id).catch((error) => {
|
const res = await deleteFunctionById(localStorage.token, func.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -132,7 +132,7 @@
|
|||||||
|
|
||||||
const toggleGlobalHandler = async (func) => {
|
const toggleGlobalHandler = async (func) => {
|
||||||
const res = await toggleGlobalById(localStorage.token, func.id).catch((error) => {
|
const res = await toggleGlobalById(localStorage.token, func.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -418,7 +418,7 @@
|
|||||||
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
const _functions = await exportFunctions(localStorage.token).catch((error) => {
|
const _functions = await exportFunctions(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -510,7 +510,7 @@
|
|||||||
|
|
||||||
for (const func of _functions) {
|
for (const func of _functions) {
|
||||||
const res = await createNewFunction(localStorage.token, func).catch((error) => {
|
const res = await createNewFunction(localStorage.token, func).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
OPENAI_API_KEYS: OPENAI_API_KEYS,
|
OPENAI_API_KEYS: OPENAI_API_KEYS,
|
||||||
OPENAI_API_CONFIGS: OPENAI_API_CONFIGS
|
OPENAI_API_CONFIGS: OPENAI_API_CONFIGS
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -88,7 +88,7 @@
|
|||||||
OLLAMA_BASE_URLS: OLLAMA_BASE_URLS,
|
OLLAMA_BASE_URLS: OLLAMA_BASE_URLS,
|
||||||
OLLAMA_API_CONFIGS: OLLAMA_API_CONFIGS
|
OLLAMA_API_CONFIGS: OLLAMA_API_CONFIGS
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
const verifyOllamaHandler = async () => {
|
const verifyOllamaHandler = async () => {
|
||||||
const res = await verifyOllamaConnection(localStorage.token, url, key).catch((error) => {
|
const res = await verifyOllamaConnection(localStorage.token, url, key).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
const verifyOpenAIHandler = async () => {
|
const verifyOpenAIHandler = async () => {
|
||||||
const res = await verifyOpenAIConnection(localStorage.token, url, key).catch((error) => {
|
const res = await verifyOpenAIConnection(localStorage.token, url, key).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
reader.onload = async (e) => {
|
reader.onload = async (e) => {
|
||||||
const res = await importConfig(localStorage.token, JSON.parse(e.target.result)).catch(
|
const res = await importConfig(localStorage.token, JSON.parse(e.target.result)).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -132,7 +132,7 @@
|
|||||||
// exportAllUserChats();
|
// exportAllUserChats();
|
||||||
|
|
||||||
downloadDatabase(localStorage.token).catch((error) => {
|
downloadDatabase(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
url: OpenAIUrl
|
url: OpenAIUrl
|
||||||
}
|
}
|
||||||
}).catch(async (error) => {
|
}).catch(async (error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
await setEmbeddingConfig();
|
await setEmbeddingConfig();
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@ -142,7 +142,7 @@
|
|||||||
const res = await updateRerankingConfig(localStorage.token, {
|
const res = await updateRerankingConfig(localStorage.token, {
|
||||||
reranking_model: rerankingModel
|
reranking_model: rerankingModel
|
||||||
}).catch(async (error) => {
|
}).catch(async (error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
await setRerankingConfig();
|
await setRerankingConfig();
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@ -258,7 +258,7 @@
|
|||||||
bind:show={showResetUploadDirConfirm}
|
bind:show={showResetUploadDirConfirm}
|
||||||
on:confirm={async () => {
|
on:confirm={async () => {
|
||||||
const res = await deleteAllFiles(localStorage.token).catch((error) => {
|
const res = await deleteAllFiles(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -272,7 +272,7 @@
|
|||||||
bind:show={showResetConfirm}
|
bind:show={showResetConfirm}
|
||||||
on:confirm={() => {
|
on:confirm={() => {
|
||||||
const res = resetVectorDB(localStorage.token).catch((error) => {
|
const res = resetVectorDB(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
const updateLdapServerHandler = async () => {
|
const updateLdapServerHandler = async () => {
|
||||||
if (!ENABLE_LDAP) return;
|
if (!ENABLE_LDAP) return;
|
||||||
const res = await updateLdapServer(localStorage.token, LDAP_SERVER).catch((error) => {
|
const res = await updateLdapServer(localStorage.token, LDAP_SERVER).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
const getModels = async () => {
|
const getModels = async () => {
|
||||||
models = await getImageGenerationModels(localStorage.token).catch((error) => {
|
models = await getImageGenerationModels(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -107,11 +107,11 @@
|
|||||||
const updateConfigHandler = async () => {
|
const updateConfigHandler = async () => {
|
||||||
const res = await updateConfig(localStorage.token, config)
|
const res = await updateConfig(localStorage.token, config)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -159,13 +159,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
await updateConfig(localStorage.token, config).catch((error) => {
|
await updateConfig(localStorage.token, config).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
loading = false;
|
loading = false;
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
await updateImageGenerationConfig(localStorage.token, imageGenerationConfig).catch((error) => {
|
await updateImageGenerationConfig(localStorage.token, imageGenerationConfig).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
loading = false;
|
loading = false;
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@ -178,7 +178,7 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if ($user.role === 'admin') {
|
if ($user.role === 'admin') {
|
||||||
const res = await getConfig(localStorage.token).catch((error) => {
|
const res = await getConfig(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -211,7 +211,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const imageConfigRes = await getImageGenerationConfig(localStorage.token).catch((error) => {
|
const imageConfigRes = await getImageGenerationConfig(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -318,7 +318,7 @@
|
|||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
await updateConfigHandler();
|
await updateConfigHandler();
|
||||||
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
|
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -454,7 +454,7 @@
|
|||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
await updateConfigHandler();
|
await updateConfigHandler();
|
||||||
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
|
const res = await verifyConfigUrl(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
updateModelId = model.id;
|
updateModelId = model.id;
|
||||||
const [res, controller] = await pullModel(localStorage.token, model.id, urlIdx).catch(
|
const [res, controller] = await pullModel(localStorage.token, model.id, urlIdx).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
const [res, controller] = await pullModel(localStorage.token, sanitizedModelTag, urlIdx).catch(
|
const [res, controller] = await pullModel(localStorage.token, sanitizedModelTag, urlIdx).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -220,7 +220,7 @@
|
|||||||
error = error.message;
|
error = error.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
// opts.callback({ success: false, error, modelName: opts.modelName });
|
// opts.callback({ success: false, error, modelName: opts.modelName });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@
|
|||||||
uploadMessage = 'Uploading...';
|
uploadMessage = 'Uploading...';
|
||||||
|
|
||||||
fileResponse = await uploadModel(localStorage.token, file, urlIdx).catch((error) => {
|
fileResponse = await uploadModel(localStorage.token, file, urlIdx).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@
|
|||||||
uploadProgress = 0;
|
uploadProgress = 0;
|
||||||
fileResponse = await downloadModel(localStorage.token, modelFileUrl, urlIdx).catch(
|
fileResponse = await downloadModel(localStorage.token, modelFileUrl, urlIdx).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -378,7 +378,7 @@
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@
|
|||||||
|
|
||||||
const deleteModelHandler = async () => {
|
const deleteModelHandler = async () => {
|
||||||
const res = await deleteModel(localStorage.token, deleteModelTag, urlIdx).catch((error) => {
|
const res = await deleteModel(localStorage.token, deleteModelTag, urlIdx).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -433,7 +433,7 @@
|
|||||||
createModelContent,
|
createModelContent,
|
||||||
urlIdx
|
urlIdx
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -487,7 +487,7 @@
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
valves,
|
valves,
|
||||||
selectedPipelinesUrlIdx
|
selectedPipelinesUrlIdx
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -118,7 +118,7 @@
|
|||||||
pipelineDownloadUrl,
|
pipelineDownloadUrl,
|
||||||
selectedPipelinesUrlIdx
|
selectedPipelinesUrlIdx
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -172,7 +172,7 @@
|
|||||||
pipelines[selectedPipelineIdx].id,
|
pipelines[selectedPipelineIdx].id,
|
||||||
selectedPipelinesUrlIdx
|
selectedPipelinesUrlIdx
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
const addGroupHandler = async (group) => {
|
const addGroupHandler = async (group) => {
|
||||||
const res = await createNewGroup(localStorage.token, group).catch((error) => {
|
const res = await createNewGroup(localStorage.token, group).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
const res = await updateUserDefaultPermissions(localStorage.token, group.permissions).catch(
|
const res = await updateUserDefaultPermissions(localStorage.token, group.permissions).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
const updateHandler = async (_group) => {
|
const updateHandler = async (_group) => {
|
||||||
const res = await updateGroupById(localStorage.token, group.id, _group).catch((error) => {
|
const res = await updateGroupById(localStorage.token, group.id, _group).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
const deleteHandler = async () => {
|
const deleteHandler = async () => {
|
||||||
const res = await deleteGroupById(localStorage.token, group.id).catch((error) => {
|
const res = await deleteGroupById(localStorage.token, group.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
const updateRoleHandler = async (id, role) => {
|
const updateRoleHandler = async (id, role) => {
|
||||||
const res = await updateUserRole(localStorage.token, id, role).catch((error) => {
|
const res = await updateUserRole(localStorage.token, id, role).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
const deleteUserHandler = async (id) => {
|
const deleteUserHandler = async (id) => {
|
||||||
const res = await deleteUserById(localStorage.token, id).catch((error) => {
|
const res = await deleteUserById(localStorage.token, id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
_user.password,
|
_user.password,
|
||||||
_user.role
|
_user.role
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
const submitHandler = async () => {
|
const submitHandler = async () => {
|
||||||
const res = await updateUserById(localStorage.token, selectedUser.id, _user).catch((error) => {
|
const res = await updateUserById(localStorage.token, selectedUser.id, _user).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
const deleteChatHandler = async (chatId) => {
|
const deleteChatHandler = async (chatId) => {
|
||||||
const res = await deleteChatById(localStorage.token, chatId).catch((error) => {
|
const res = await deleteChatById(localStorage.token, chatId).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
chats = await getChatListByUserId(localStorage.token, user.id);
|
chats = await getChatListByUserId(localStorage.token, user.id);
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
const res = await sendMessage(localStorage.token, id, { content: content, data: data }).catch(
|
const res = await sendMessage(localStorage.token, id, { content: content, data: data }).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -158,7 +158,7 @@
|
|||||||
// Check if the file is an audio file and transcribe/convert it to text file
|
// Check if the file is an audio file and transcribe/convert it to text file
|
||||||
if (['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/x-m4a'].includes(file['type'])) {
|
if (['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/x-m4a'].includes(file['type'])) {
|
||||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@
|
|||||||
|
|
||||||
const res = deleteMessage(localStorage.token, message.channel_id, message.id).catch(
|
const res = deleteMessage(localStorage.token, message.channel_id, message.id).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -118,7 +118,7 @@
|
|||||||
const res = updateMessage(localStorage.token, message.channel_id, message.id, {
|
const res = updateMessage(localStorage.token, message.channel_id, message.id, {
|
||||||
content: content
|
content: content
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
@ -154,7 +154,7 @@
|
|||||||
message.id,
|
message.id,
|
||||||
name
|
name
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -180,7 +180,7 @@
|
|||||||
|
|
||||||
const res = addReaction(localStorage.token, message.channel_id, message.id, name).catch(
|
const res = addReaction(localStorage.token, message.channel_id, message.id, name).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -128,7 +128,7 @@
|
|||||||
content: content,
|
content: content,
|
||||||
data: data
|
data: data
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -838,7 +838,7 @@
|
|||||||
session_id: $socket?.id,
|
session_id: $socket?.id,
|
||||||
id: responseMessageId
|
id: responseMessageId
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
messages.at(-1).error = { content: error };
|
messages.at(-1).error = { content: error };
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -896,7 +896,7 @@
|
|||||||
session_id: $socket?.id,
|
session_id: $socket?.id,
|
||||||
id: responseMessageId
|
id: responseMessageId
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
messages.at(-1).error = { content: error };
|
messages.at(-1).error = { content: error };
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@ -1404,7 +1404,7 @@
|
|||||||
if ($settings?.memory ?? false) {
|
if ($settings?.memory ?? false) {
|
||||||
if (userContext === null) {
|
if (userContext === null) {
|
||||||
const res = await queryMemory(localStorage.token, prompt).catch((error) => {
|
const res = await queryMemory(localStorage.token, prompt).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
if (tab === 'tools') {
|
if (tab === 'tools') {
|
||||||
const res = await updateToolUserValvesById(localStorage.token, selectedId, valves).catch(
|
const res = await updateToolUserValvesById(localStorage.token, selectedId, valves).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -97,7 +97,7 @@
|
|||||||
selectedId,
|
selectedId,
|
||||||
valves
|
valves
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@
|
|||||||
// Check if the file is an audio file and transcribe/convert it to text file
|
// Check if the file is an audio file and transcribe/convert it to text file
|
||||||
if (['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/x-m4a'].includes(file['type'])) {
|
if (['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/x-m4a'].includes(file['type'])) {
|
||||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@
|
|||||||
const file = blobToFile(audioBlob, 'recording.wav');
|
const file = blobToFile(audioBlob, 'recording.wav');
|
||||||
|
|
||||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@
|
|||||||
const file = blobToFile(audioBlob, 'recording.wav');
|
const file = blobToFile(audioBlob, 'recording.wav');
|
||||||
|
|
||||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@
|
|||||||
sentence
|
sentence
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
|
|
||||||
speaking = false;
|
speaking = false;
|
||||||
loadingSpeech = false;
|
loadingSpeech = false;
|
||||||
@ -321,7 +321,7 @@
|
|||||||
const generateImage = async (message: MessageType) => {
|
const generateImage = async (message: MessageType) => {
|
||||||
generatingImage = true;
|
generatingImage = true;
|
||||||
const res = await imageGenerations(localStorage.token, message.content).catch((error) => {
|
const res = await imageGenerations(localStorage.token, message.content).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
||||||
@ -356,7 +356,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const chat = await getChatById(localStorage.token, chatId).catch((error) => {
|
const chat = await getChatById(localStorage.token, chatId).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
return;
|
return;
|
||||||
@ -411,11 +411,11 @@
|
|||||||
message.feedbackId,
|
message.feedbackId,
|
||||||
feedbackItem
|
feedbackItem
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
feedback = await createNewFeedback(localStorage.token, feedbackItem).catch((error) => {
|
feedback = await createNewFeedback(localStorage.token, feedbackItem).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (feedback) {
|
if (feedback) {
|
||||||
@ -451,7 +451,7 @@
|
|||||||
updatedMessage.feedbackId,
|
updatedMessage.feedbackId,
|
||||||
feedbackItem
|
feedbackItem
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
const [res, controller] = await pullModel(localStorage.token, sanitizedModelTag, '0').catch(
|
const [res, controller] = await pullModel(localStorage.token, sanitizedModelTag, '0').catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -173,7 +173,7 @@
|
|||||||
error = error.message;
|
error = error.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
// opts.callback({ success: false, error, modelName: opts.modelName });
|
// opts.callback({ success: false, error, modelName: opts.modelName });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch(
|
const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
if (newPassword === newPasswordConfirm) {
|
if (newPassword === newPasswordConfirm) {
|
||||||
const res = await updateUserPassword(localStorage.token, currentPassword, newPassword).catch(
|
const res = await updateUserPassword(localStorage.token, currentPassword, newPassword).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
const archiveAllChatsHandler = async () => {
|
const archiveAllChatsHandler = async () => {
|
||||||
await goto('/');
|
await goto('/');
|
||||||
await archiveAllChats(localStorage.token).catch((error) => {
|
await archiveAllChats(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(1);
|
currentChatPage.set(1);
|
||||||
@ -88,7 +88,7 @@
|
|||||||
const deleteAllChatsHandler = async () => {
|
const deleteAllChatsHandler = async () => {
|
||||||
await goto('/');
|
await goto('/');
|
||||||
await deleteAllChats(localStorage.token).catch((error) => {
|
await deleteAllChats(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(1);
|
currentChatPage.set(1);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
const res = await addNewMemory(localStorage.token, content).catch((error) => {
|
const res = await addNewMemory(localStorage.token, content).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
const res = await updateMemoryById(localStorage.token, memory.id, content).catch((error) => {
|
const res = await updateMemoryById(localStorage.token, memory.id, content).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
localStorage.token,
|
localStorage.token,
|
||||||
memory.id
|
memory.id
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -177,7 +177,7 @@
|
|||||||
class=" px-3.5 py-1.5 font-medium text-red-500 hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-red-300 dark:outline-red-800 rounded-3xl"
|
class=" px-3.5 py-1.5 font-medium text-red-500 hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-red-300 dark:outline-red-800 rounded-3xl"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
const res = await deleteMemoriesByUserId(localStorage.token).catch((error) => {
|
const res = await deleteMemoriesByUserId(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
const addTag = async (tagName) => {
|
const addTag = async (tagName) => {
|
||||||
const res = await addTagById(localStorage.token, chatId, tagName).catch(async (error) => {
|
const res = await addTagById(localStorage.token, chatId, tagName).catch(async (error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
export const formatPythonCodeHandler = async () => {
|
export const formatPythonCodeHandler = async () => {
|
||||||
if (codeEditor) {
|
if (codeEditor) {
|
||||||
const res = await formatPythonCode(_value).catch((error) => {
|
const res = await formatPythonCode(_value).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
const initFolders = async () => {
|
const initFolders = async () => {
|
||||||
const folderList = await getFolders(localStorage.token).catch((error) => {
|
const folderList = await getFolders(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -144,7 +144,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const res = await createNewFolder(localStorage.token, name).catch((error) => {
|
const res = await createNewFolder(localStorage.token, name).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -433,7 +433,7 @@
|
|||||||
name: name,
|
name: name,
|
||||||
access_control: access_control
|
access_control: access_control
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -646,7 +646,7 @@
|
|||||||
if (chat.folder_id) {
|
if (chat.folder_id) {
|
||||||
const res = await updateChatFolderIdById(localStorage.token, chat.id, null).catch(
|
const res = await updateChatFolderIdById(localStorage.token, chat.id, null).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -665,7 +665,7 @@
|
|||||||
|
|
||||||
const res = await updateFolderParentIdById(localStorage.token, id, null).catch(
|
const res = await updateFolderParentIdById(localStorage.token, id, null).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -711,7 +711,7 @@
|
|||||||
chat.id,
|
chat.id,
|
||||||
null
|
null
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
const unarchiveChatHandler = async (chatId) => {
|
const unarchiveChatHandler = async (chatId) => {
|
||||||
const res = await archiveChatById(localStorage.token, chatId).catch((error) => {
|
const res = await archiveChatById(localStorage.token, chatId).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
chats = await getArchivedChatList(localStorage.token);
|
chats = await getArchivedChatList(localStorage.token);
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
const deleteChatHandler = async (chatId) => {
|
const deleteChatHandler = async (chatId) => {
|
||||||
const res = await deleteChatById(localStorage.token, chatId).catch((error) => {
|
const res = await deleteChatById(localStorage.token, chatId).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
chats = await getArchivedChatList(localStorage.token);
|
chats = await getArchivedChatList(localStorage.token);
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
const cloneChatHandler = async (id) => {
|
const cloneChatHandler = async (id) => {
|
||||||
const res = await cloneChatById(localStorage.token, id).catch((error) => {
|
const res = await cloneChatById(localStorage.token, id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
const deleteChatHandler = async (id) => {
|
const deleteChatHandler = async (id) => {
|
||||||
const res = await deleteChatById(localStorage.token, id).catch((error) => {
|
const res = await deleteChatById(localStorage.token, id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
// Move the folder
|
// Move the folder
|
||||||
const res = await updateFolderParentIdById(localStorage.token, id, folderId).catch(
|
const res = await updateFolderParentIdById(localStorage.token, id, folderId).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -137,7 +137,7 @@
|
|||||||
// Move the chat
|
// Move the chat
|
||||||
const res = await updateChatFolderIdById(localStorage.token, chat.id, folderId).catch(
|
const res = await updateChatFolderIdById(localStorage.token, chat.id, folderId).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
const deleteHandler = async () => {
|
const deleteHandler = async () => {
|
||||||
const res = await deleteFolderById(localStorage.token, folderId).catch((error) => {
|
const res = await deleteFolderById(localStorage.token, folderId).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -260,7 +260,7 @@
|
|||||||
folders[folderId].name = name;
|
folders[folderId].name = name;
|
||||||
|
|
||||||
const res = await updateFolderNameById(localStorage.token, folderId, name).catch((error) => {
|
const res = await updateFolderNameById(localStorage.token, folderId, name).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
|
|
||||||
folders[folderId].name = currentName;
|
folders[folderId].name = currentName;
|
||||||
return null;
|
return null;
|
||||||
@ -276,7 +276,7 @@
|
|||||||
const isExpandedUpdateHandler = async () => {
|
const isExpandedUpdateHandler = async () => {
|
||||||
const res = await updateFolderIsExpandedById(localStorage.token, folderId, open).catch(
|
const res = await updateFolderIsExpandedById(localStorage.token, folderId, open).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -310,7 +310,7 @@
|
|||||||
|
|
||||||
const exportHandler = async () => {
|
const exportHandler = async () => {
|
||||||
const chats = await getChatsByFolderId(localStorage.token, folderId).catch((error) => {
|
const chats = await getChatsByFolderId(localStorage.token, folderId).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (!chats) {
|
if (!chats) {
|
||||||
|
@ -136,7 +136,7 @@
|
|||||||
// Check if the file is an audio file and transcribe/convert it to text file
|
// Check if the file is an audio file and transcribe/convert it to text file
|
||||||
if (['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/x-m4a'].includes(file['type'])) {
|
if (['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/x-m4a'].includes(file['type'])) {
|
||||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@
|
|||||||
title: prompt.title,
|
title: prompt.title,
|
||||||
content: prompt.content
|
content: prompt.content
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
const shareHandler = async (tool) => {
|
const shareHandler = async (tool) => {
|
||||||
const item = await getToolById(localStorage.token, tool.id).catch((error) => {
|
const item = await getToolById(localStorage.token, tool.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
const cloneHandler = async (tool) => {
|
const cloneHandler = async (tool) => {
|
||||||
const _tool = await getToolById(localStorage.token, tool.id).catch((error) => {
|
const _tool = await getToolById(localStorage.token, tool.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
const exportHandler = async (tool) => {
|
const exportHandler = async (tool) => {
|
||||||
const _tool = await getToolById(localStorage.token, tool.id).catch((error) => {
|
const _tool = await getToolById(localStorage.token, tool.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
const deleteHandler = async (tool) => {
|
const deleteHandler = async (tool) => {
|
||||||
const res = await deleteToolById(localStorage.token, tool.id).catch((error) => {
|
const res = await deleteToolById(localStorage.token, tool.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -402,7 +402,7 @@
|
|||||||
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
const _tools = await exportTools(localStorage.token).catch((error) => {
|
const _tools = await exportTools(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -487,7 +487,7 @@
|
|||||||
|
|
||||||
for (const tool of _tools) {
|
for (const tool of _tools) {
|
||||||
const res = await createNewTool(localStorage.token, tool).catch((error) => {
|
const res = await createNewTool(localStorage.token, tool).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@
|
|||||||
|
|
||||||
if (type === 'tool') {
|
if (type === 'tool') {
|
||||||
res = await updateToolValvesById(localStorage.token, id, valves).catch((error) => {
|
res = await updateToolValvesById(localStorage.token, id, valves).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
} else if (type === 'function') {
|
} else if (type === 'function') {
|
||||||
res = await updateFunctionValvesById(localStorage.token, id, valves).catch((error) => {
|
res = await updateFunctionValvesById(localStorage.token, id, valves).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
meta: data.meta,
|
meta: data.meta,
|
||||||
content: data.content
|
content: data.content
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
meta: data.meta,
|
meta: data.meta,
|
||||||
content: data.content
|
content: data.content
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
func = await getFunctionById(localStorage.token, id).catch((error) => {
|
func = await getFunctionById(localStorage.token, id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
goto('/admin/functions');
|
goto('/admin/functions');
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
},
|
},
|
||||||
params: { ...modelInfo.params }
|
params: { ...modelInfo.params }
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
let prompt = null;
|
let prompt = null;
|
||||||
const onSubmit = async (_prompt) => {
|
const onSubmit = async (_prompt) => {
|
||||||
const prompt = await createNewPrompt(localStorage.token, _prompt).catch((error) => {
|
const prompt = await createNewPrompt(localStorage.token, _prompt).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
const onSubmit = async (_prompt) => {
|
const onSubmit = async (_prompt) => {
|
||||||
console.log(_prompt);
|
console.log(_prompt);
|
||||||
const prompt = await updatePromptByCommand(localStorage.token, _prompt).catch((error) => {
|
const prompt = await updatePromptByCommand(localStorage.token, _prompt).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -33,7 +33,7 @@
|
|||||||
localStorage.token,
|
localStorage.token,
|
||||||
command.replace(/\//g, '')
|
command.replace(/\//g, '')
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
content: data.content,
|
content: data.content,
|
||||||
access_control: data.access_control
|
access_control: data.access_control
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
content: data.content,
|
content: data.content,
|
||||||
access_control: data.access_control
|
access_control: data.access_control
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
tool = await getToolById(localStorage.token, id).catch((error) => {
|
tool = await getToolById(localStorage.token, id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
goto('/workspace/tools');
|
goto('/workspace/tools');
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -280,7 +280,7 @@
|
|||||||
if (localStorage.token) {
|
if (localStorage.token) {
|
||||||
// Get Session User Info
|
// Get Session User Info
|
||||||
const sessionUser = await getSessionUser(localStorage.token).catch((error) => {
|
const sessionUser = await getSessionUser(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
const signInHandler = async () => {
|
const signInHandler = async () => {
|
||||||
const sessionUser = await userSignIn(email, password).catch((error) => {
|
const sessionUser = await userSignIn(email, password).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -55,7 +55,7 @@
|
|||||||
const signUpHandler = async () => {
|
const signUpHandler = async () => {
|
||||||
const sessionUser = await userSignUp(name, email, password, generateInitialsImage(name)).catch(
|
const sessionUser = await userSignUp(name, email, password, generateInitialsImage(name)).catch(
|
||||||
(error) => {
|
(error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
const ldapSignInHandler = async () => {
|
const ldapSignInHandler = async () => {
|
||||||
const sessionUser = await ldapUserSignIn(ldapUsername, password).catch((error) => {
|
const sessionUser = await ldapUserSignIn(ldapUsername, password).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
await setSessionUser(sessionUser);
|
await setSessionUser(sessionUser);
|
||||||
@ -95,7 +95,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sessionUser = await getSessionUser(token).catch((error) => {
|
const sessionUser = await getSessionUser(token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (!sessionUser) {
|
if (!sessionUser) {
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
if (!chat) return;
|
if (!chat) return;
|
||||||
|
|
||||||
const res = await cloneSharedChatById(localStorage.token, chat.id).catch((error) => {
|
const res = await cloneSharedChatById(localStorage.token, chat.id).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user