|
| 1 | +<script lang="ts"> |
| 2 | + import { Icon, DocumentDuplicate, CodeBracket } from "svelte-hero-icons"; |
| 3 | + import TopCover from "$lib/components/common/top-cover/TopCover.svelte"; |
| 4 | + import Typography from "$lib/components/common/typography/Typography.svelte"; |
| 5 | + import Card from "$lib/components/common/card/Card.svelte"; |
| 6 | + import Button from "$lib/components/common/button/Button.svelte"; |
| 7 | + import Input from "$lib/components/common/input/Input.svelte"; |
| 8 | + import type { PageData } from "$lib/types"; |
| 9 | + import { z as zod } from "zod"; |
| 10 | + import { superForm } from "sveltekit-superforms/client"; |
| 11 | + import Spacer from "$lib/components/common/spacer/Spacer.svelte"; |
| 12 | + export let data: PageData; |
| 13 | +
|
| 14 | + const { form, errors, validate } = superForm(data.form, { |
| 15 | + validators: zod.object({ |
| 16 | + name: zod.string().min(3).max(20) |
| 17 | + }), |
| 18 | + validationMethod: "oninput" |
| 19 | + }); |
| 20 | +
|
| 21 | + const handleValidation = async (e: Event) => { |
| 22 | + e.preventDefault(); |
| 23 | + const res = await validate(); |
| 24 | +
|
| 25 | + if (!res.valid) { |
| 26 | + errors.set(res.errors); |
| 27 | + return; |
| 28 | + } |
| 29 | + }; |
| 30 | +</script> |
| 31 | + |
| 32 | +<div> |
| 33 | + <TopCover> |
| 34 | + <section class="p-12 flex items-center gap-4"> |
| 35 | + <span class="text-body-accent dark:text-body-accent-dark font-semibold text-2xl" |
| 36 | + >My super cool agent</span> |
| 37 | + <div |
| 38 | + class="bg-background-accent dark:bg-background-accent-dark flex items-center gap-2 border border-stroke-accent dark:border-stroke-accent-dark rounded-full py-1.5 px-5 text-body-base dark:text-body-base-dark text-sm antialiased"> |
| 39 | + <Icon src={DocumentDuplicate} width="15" /> |
| 40 | + Copy Agent ID |
| 41 | + </div> |
| 42 | + </section> |
| 43 | + </TopCover> |
| 44 | + <div class="w-full p-10 pb-32"> |
| 45 | + <div class="max-w-6xl m-auto mt-10"> |
| 46 | + <Card> |
| 47 | + <section class="p-10 antialiased min-h-[200px]"> |
| 48 | + <Typography type="mainSectionTitle">Getting started</Typography> |
| 49 | + <Typography type="subTitle">Setup your project like a boss</Typography> |
| 50 | + </section> |
| 51 | + <section |
| 52 | + class="p-10 antialiased min-h-[200px] border-t border-stroke-base dark:border-stroke-base-dark"> |
| 53 | + <div class="grid grid-cols-5 gap-10"> |
| 54 | + <div class="col-span-2"> |
| 55 | + <Typography type="sectionTitle">Integrate in your server</Typography> |
| 56 | + <Typography type="subTitle" |
| 57 | + >Our SDKs let you control your agent frontend with bidirectionnal |
| 58 | + streaming and even more features.</Typography> |
| 59 | + </div> |
| 60 | + <div class="col-span-3 grid grid-cols-2 gap-5"> |
| 61 | + <div |
| 62 | + class="antialiased border rounded-xl py-7 px-7 border-stroke-base dark:border-stroke-base-dark flex items-center justify-center gap-3 text-body-base dark:text-body-base-dark hover:bg-background-accent dark:hover:bg-background-accent-dark cursor-pointer"> |
| 63 | + <div |
| 64 | + class="rounded-full border border-stroke-base dark:border-stroke-base-dark p-3 bg-background-secondary dark:bg-background-secondary-dark"> |
| 65 | + <Icon src={CodeBracket} width="20" class="text-body-subdued" /> |
| 66 | + </div> |
| 67 | + <div>NodeJS SDK</div> |
| 68 | + </div> |
| 69 | + <div |
| 70 | + class="antialiased border rounded-xl py-7 px-7 border-stroke-base dark:border-stroke-base-dark flex items-center justify-center gap-3 text-body-base dark:text-body-base-dark hover:bg-background-accent dark:hover:bg-background-accent-dark cursor-pointer"> |
| 71 | + <div |
| 72 | + class="rounded-full border border-stroke-base dark:border-stroke-base-dark p-3 bg-background-secondary dark:bg-background-secondary-dark"> |
| 73 | + <Icon src={CodeBracket} width="20" class="text-body-subdued" /> |
| 74 | + </div> |
| 75 | + <div>Python SDK</div> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + </section> |
| 80 | + </Card> |
| 81 | + <Spacer size="md" /> |
| 82 | + <Card> |
| 83 | + <section class="p-10 antialiased"> |
| 84 | + <div class="grid grid-cols-5 gap-10"> |
| 85 | + <div class="col-span-2"> |
| 86 | + <Typography type="sectionTitle">Rename your agent</Typography> |
| 87 | + <Typography type="subTitle" |
| 88 | + >This will change the named displayed on your UI interface.</Typography> |
| 89 | + </div> |
| 90 | + <div class="col-span-3 gap-5"> |
| 91 | + <form on:submit={handleValidation}> |
| 92 | + <Input |
| 93 | + bind:value={$form.name} |
| 94 | + label="Agent name" |
| 95 | + required |
| 96 | + name="name" |
| 97 | + errors={$errors?.name} |
| 98 | + type="text" |
| 99 | + placeholder="Project name" /> |
| 100 | + </form> |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + </section> |
| 104 | + <Spacer size="md" /> |
| 105 | + <section |
| 106 | + class="px-10 py-5 antialiased border-t border-stroke-base dark:border-stroke-base-dark flex justify-end"> |
| 107 | + <div> |
| 108 | + <Button |
| 109 | + disabled={!$form.name || !!$errors?.name} |
| 110 | + submit |
| 111 | + type="primary" |
| 112 | + center>Update</Button> |
| 113 | + </div> |
| 114 | + </section> |
| 115 | + </Card> |
| 116 | + <Spacer size="md" /> |
| 117 | + <Card> |
| 118 | + <section class="p-10 antialiased"> |
| 119 | + <div class="flex flex-col gap-3"> |
| 120 | + <Typography type="sectionTitle">Danger zone</Typography> |
| 121 | + <div |
| 122 | + class="border-l-2 border-stroke-warning dark:border-stroke-warning-dark p-5 bg-background-warning dark:bg-background-warning-dark text-body-warning dark:text-body-warning-dark text-sm"> |
| 123 | + Removing an agent will instantly make it unavailable for all your users |
| 124 | + and result in losing all data and events related to this agent. We |
| 125 | + assume you know what you are doing. |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + </section> |
| 129 | + <Spacer size="md" /> |
| 130 | + <section |
| 131 | + class="px-10 py-5 antialiased border-t border-stroke-base dark:border-stroke-base-dark flex justify-end"> |
| 132 | + <div> |
| 133 | + <Button |
| 134 | + disabled={!$form.name || !!$errors?.name} |
| 135 | + submit |
| 136 | + type="danger" |
| 137 | + center>Delete forever</Button> |
| 138 | + </div> |
| 139 | + </section> |
| 140 | + </Card> |
| 141 | + </div> |
| 142 | + </div> |
| 143 | +</div> |
0 commit comments