From a691ee08d8f467b176765372a1b344636f239d2d Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 12 Jun 2024 01:17:46 -0700 Subject: [PATCH] feat: confirm dialog --- .../components/common/ConfirmDialog.svelte | 106 ++++++++++++++++++ .../workspace/Tools/ToolkitEditor.svelte | 30 ++++- 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/lib/components/common/ConfirmDialog.svelte diff --git a/src/lib/components/common/ConfirmDialog.svelte b/src/lib/components/common/ConfirmDialog.svelte new file mode 100644 index 000000000..4a243b928 --- /dev/null +++ b/src/lib/components/common/ConfirmDialog.svelte @@ -0,0 +1,106 @@ + + +{#if show} + + +
{ + show = false; + }} + > +
{ + e.stopPropagation(); + }} + > +
+
{title}
+ + +
+ {message} +
+
+ +
+ + +
+
+
+
+{/if} + + diff --git a/src/lib/components/workspace/Tools/ToolkitEditor.svelte b/src/lib/components/workspace/Tools/ToolkitEditor.svelte index d0db87ef2..2b0dbb485 100644 --- a/src/lib/components/workspace/Tools/ToolkitEditor.svelte +++ b/src/lib/components/workspace/Tools/ToolkitEditor.svelte @@ -5,11 +5,13 @@ import CodeEditor from './CodeEditor.svelte'; import { goto } from '$app/navigation'; + import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte'; const dispatch = createEventDispatcher(); let formElement = null; let loading = false; + let showConfirm = false; export let edit = false; export let clone = false; @@ -55,7 +57,7 @@ bind:this={formElement} class=" flex flex-col max-h-[100dvh] h-full" on:submit|preventDefault={() => { - submitHandler(); + showConfirm = true; }} >
@@ -135,8 +137,10 @@ >
+ @@ -145,3 +149,27 @@ + + { + submitHandler(); + }} +> +
+
+
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. +
+
+