+ {/if}
diff --git a/src/lib/components/workspace/Models.svelte b/src/lib/components/workspace/Models.svelte
index 3c509a0bc..c9137fb85 100644
--- a/src/lib/components/workspace/Models.svelte
+++ b/src/lib/components/workspace/Models.svelte
@@ -93,13 +93,10 @@
const tab = await window.open(`${url}/models/create`, '_blank');
- // Define the event handler function
const messageHandler = (event) => {
if (event.origin !== url) return;
if (event.data === 'loaded') {
tab.postMessage(JSON.stringify(model), '*');
-
- // Remove the event listener after handling the message
window.removeEventListener('message', messageHandler);
}
};
@@ -477,29 +474,33 @@
- {
- downloadModels(models);
- }}
- >
- {$i18n.t('Export Models')}
+ {#if models.length}
+ {
+ downloadModels(models);
+ }}
+ >
+
+ {$i18n.t('Export Models')}
+
-
-
+
+
+ {/if}
{/if}
diff --git a/src/lib/components/workspace/Prompts.svelte b/src/lib/components/workspace/Prompts.svelte
index 98401f3f9..0c16b49a2 100644
--- a/src/lib/components/workspace/Prompts.svelte
+++ b/src/lib/components/workspace/Prompts.svelte
@@ -285,33 +285,36 @@
- {
- // promptsImportInputElement.click();
- let blob = new Blob([JSON.stringify(prompts)], {
- type: 'application/json'
- });
- saveAs(blob, `prompts-export-${Date.now()}.json`);
- }}
- >
- {$i18n.t('Export Prompts')}
+ {#if prompts.length}
+ {
+ let blob = new Blob([JSON.stringify(prompts)], {
+ type: 'application/json'
+ });
+ saveAs(blob, `prompts-export-${Date.now()}.json`);
+ }}
+ >
+
+ {$i18n.t('Export Prompts')}
+
-
-
+
+
+ {/if}
{/if}
diff --git a/src/lib/components/workspace/Tools.svelte b/src/lib/components/workspace/Tools.svelte
index c42ebb485..593797822 100644
--- a/src/lib/components/workspace/Tools.svelte
+++ b/src/lib/components/workspace/Tools.svelte
@@ -71,13 +71,10 @@
const tab = await window.open(`${url}/tools/create`, '_blank');
- // Define the event handler function
const messageHandler = (event) => {
if (event.origin !== url) return;
if (event.data === 'loaded') {
tab.postMessage(JSON.stringify(item), '*');
-
- // Remove the event listener after handling the message
window.removeEventListener('message', messageHandler);
}
};
@@ -124,8 +121,7 @@
if (res) {
toast.success($i18n.t('Tool deleted successfully'));
-
- init();
+ await init();
}
};
@@ -398,39 +394,41 @@
- {
- const _tools = await exportTools(localStorage.token).catch((error) => {
- toast.error(`${error}`);
- return null;
- });
-
- if (_tools) {
- let blob = new Blob([JSON.stringify(_tools)], {
- type: 'application/json'
+ {#if tools.length}
+ {
+ const _tools = await exportTools(localStorage.token).catch((error) => {
+ toast.error(`${error}`);
+ return null;
});
- saveAs(blob, `tools-export-${Date.now()}.json`);
- }
- }}
- >
- {$i18n.t('Export Tools')}
-
-
+ if (_tools) {
+ let blob = new Blob([JSON.stringify(_tools)], {
+ type: 'application/json'
+ });
+ saveAs(blob, `tools-export-${Date.now()}.json`);
+ }
+ }}
+ >
+ {$i18n.t('Export Tools')}
+
+
+
+ {/if}
{/if}