diff --git a/src/lib/components/workspace/Tools.svelte b/src/lib/components/workspace/Tools.svelte index e6d97d2eb..637eeb44a 100644 --- a/src/lib/components/workspace/Tools.svelte +++ b/src/lib/components/workspace/Tools.svelte @@ -17,12 +17,14 @@ } from '$lib/apis/tools'; import ArrowDownTray from '../icons/ArrowDownTray.svelte'; import Tooltip from '../common/Tooltip.svelte'; + import ConfirmDialog from '../common/ConfirmDialog.svelte'; const i18n = getContext('i18n'); let toolsImportInputElement: HTMLInputElement; let importFiles; + let showConfirm = false; let query = ''; @@ -251,24 +253,7 @@ hidden on:change={() => { console.log(importFiles); - - const reader = new FileReader(); - reader.onload = async (event) => { - const _tools = JSON.parse(event.target.result); - console.log(_tools); - - for (const tool of _tools) { - const res = await createNewTool(localStorage.token, tool).catch((error) => { - toast.error(error); - return null; - }); - } - - toast.success('Tool imported successfully'); - tools.set(await getTools(localStorage.token)); - }; - - reader.readAsText(importFiles[0]); + showConfirm = true; }} /> @@ -331,3 +316,43 @@ + + { + const reader = new FileReader(); + reader.onload = async (event) => { + const _tools = JSON.parse(event.target.result); + console.log(_tools); + + for (const tool of _tools) { + const res = await createNewTool(localStorage.token, tool).catch((error) => { + toast.error(error); + return null; + }); + } + + toast.success('Tool imported successfully'); + tools.set(await getTools(localStorage.token)); + }; + + reader.readAsText(importFiles[0]); + }} +> +
+
+
Please carefully review the following warnings:
+ +
    +
  • Tools have a function calling system that allows arbitrary code execution.
  • +
  • Do not install tools from sources you do not fully trust.
  • +
+
+ +
+ I acknowledge that I have read and I understand the implications of my action. I am aware of + the risks associated with executing arbitrary code and I have verified the trustworthiness of + the source. +
+
+