This commit is contained in:
Timothy J. Baek
2024-06-10 22:10:53 -07:00
parent c961964647
commit 8464b30485
4 changed files with 40 additions and 6 deletions

View File

@@ -8,7 +8,13 @@
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { goto } from '$app/navigation';
import { createNewTool, deleteToolById, exportTools, getTools } from '$lib/apis/tools';
import {
createNewTool,
deleteToolById,
exportTools,
getToolById,
getTools
} from '$lib/apis/tools';
const i18n = getContext('i18n');
@@ -121,9 +127,20 @@
<button
class="self-center w-fit text-sm px-2 py-2 dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
type="button"
on:click={() => {
sessionStorage.tool = JSON.stringify(tool);
goto('/workspace/tools/create');
on:click={async () => {
const _tool = await getToolById(localStorage.token, tool.id).catch((error) => {
toast.error(error);
return null;
});
if (_tool) {
sessionStorage.tool = JSON.stringify({
..._tool,
id: `${_tool.id}_clone`,
name: `${_tool.name} (Clone)`
});
goto('/workspace/tools/create');
}
}}
>
<svg

View File

@@ -9,7 +9,6 @@
const dispatch = createEventDispatcher();
let formElement = null;
let loading = false;
export let edit = false;