refac: toast error
This commit is contained in:
@@ -838,7 +838,7 @@
|
||||
session_id: $socket?.id,
|
||||
id: responseMessageId
|
||||
}).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
messages.at(-1).error = { content: error };
|
||||
|
||||
return null;
|
||||
@@ -896,7 +896,7 @@
|
||||
session_id: $socket?.id,
|
||||
id: responseMessageId
|
||||
}).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
messages.at(-1).error = { content: error };
|
||||
return null;
|
||||
});
|
||||
@@ -1404,7 +1404,7 @@
|
||||
if ($settings?.memory ?? false) {
|
||||
if (userContext === null) {
|
||||
const res = await queryMemory(localStorage.token, prompt).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
if (res) {
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
if (tab === 'tools') {
|
||||
const res = await updateToolUserValvesById(localStorage.token, selectedId, valves).catch(
|
||||
(error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -97,7 +97,7 @@
|
||||
selectedId,
|
||||
valves
|
||||
).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
// 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'])) {
|
||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
const file = blobToFile(audioBlob, 'recording.wav');
|
||||
|
||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
const file = blobToFile(audioBlob, 'recording.wav');
|
||||
|
||||
const res = await transcribeAudio(localStorage.token, file).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
sentence
|
||||
).catch((error) => {
|
||||
console.error(error);
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
|
||||
speaking = false;
|
||||
loadingSpeech = false;
|
||||
@@ -321,7 +321,7 @@
|
||||
const generateImage = async (message: MessageType) => {
|
||||
generatingImage = true;
|
||||
const res = await imageGenerations(localStorage.token, message.content).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
console.log(res);
|
||||
|
||||
@@ -356,7 +356,7 @@
|
||||
};
|
||||
|
||||
const chat = await getChatById(localStorage.token, chatId).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
if (!chat) {
|
||||
return;
|
||||
@@ -411,11 +411,11 @@
|
||||
message.feedbackId,
|
||||
feedbackItem
|
||||
).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
} else {
|
||||
feedback = await createNewFeedback(localStorage.token, feedbackItem).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
|
||||
if (feedback) {
|
||||
@@ -451,7 +451,7 @@
|
||||
updatedMessage.feedbackId,
|
||||
feedbackItem
|
||||
).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
const [res, controller] = await pullModel(localStorage.token, sanitizedModelTag, '0').catch(
|
||||
(error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -173,7 +173,7 @@
|
||||
error = error.message;
|
||||
}
|
||||
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
// opts.callback({ success: false, error, modelName: opts.modelName });
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch(
|
||||
(error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
if (newPassword === newPasswordConfirm) {
|
||||
const res = await updateUserPassword(localStorage.token, currentPassword, newPassword).catch(
|
||||
(error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
const archiveAllChatsHandler = async () => {
|
||||
await goto('/');
|
||||
await archiveAllChats(localStorage.token).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
|
||||
currentChatPage.set(1);
|
||||
@@ -88,7 +88,7 @@
|
||||
const deleteAllChatsHandler = async () => {
|
||||
await goto('/');
|
||||
await deleteAllChats(localStorage.token).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
|
||||
currentChatPage.set(1);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
loading = true;
|
||||
|
||||
const res = await addNewMemory(localStorage.token, content).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
loading = true;
|
||||
|
||||
const res = await updateMemoryById(localStorage.token, memory.id, content).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
localStorage.token,
|
||||
memory.id
|
||||
).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
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"
|
||||
on:click={async () => {
|
||||
const res = await deleteMemoriesByUserId(localStorage.token).catch((error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
const addTag = async (tagName) => {
|
||||
const res = await addTagById(localStorage.token, chatId, tagName).catch(async (error) => {
|
||||
toast.error(error);
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
if (!res) {
|
||||
|
||||
Reference in New Issue
Block a user