diff --git a/src/lib/components/admin/Functions.svelte b/src/lib/components/admin/Functions.svelte index d5c19aad2f..8a66490b81 100644 --- a/src/lib/components/admin/Functions.svelte +++ b/src/lib/components/admin/Functions.svelte @@ -771,6 +771,7 @@ const _functions = JSON.parse(event.target.result); console.log(_functions); + let imported = false; for (let func of _functions) { if ('function' in func) { // Required for Community JSON import @@ -781,9 +782,10 @@ toast.error(`${error}`); return null; }); + if (res) imported = true; } - toast.success($i18n.t('Functions imported successfully')); + if (imported) toast.success($i18n.t('Functions imported successfully')); functions = await getFunctionList(localStorage.token); _functions.set(await getFunctions(localStorage.token)); models.set(await getModels(localStorage.token, false, true)); diff --git a/src/lib/components/workspace/Tools.svelte b/src/lib/components/workspace/Tools.svelte index 7b5d6b062e..984b92c152 100644 --- a/src/lib/components/workspace/Tools.svelte +++ b/src/lib/components/workspace/Tools.svelte @@ -777,14 +777,16 @@ const _tools = JSON.parse(event.target.result); console.log(_tools); + let imported = false; for (const tool of _tools) { const res = await createNewTool(localStorage.token, tool).catch((error) => { toast.error(`${error}`); return null; }); + if (res) imported = true; } - toast.success($i18n.t('Tool imported successfully')); + if (imported) toast.success($i18n.t('Tool imported successfully')); await init(); importFiles = null; toolsImportInputElement.value = '';