import { SampleCase } from "../types"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { useNavigate } from "react-router-dom"; import { SavedTasks } from "./SavedTasks"; import { getSample } from "../data/sampleTaskData"; import { Textarea } from "@/components/ui/textarea"; import { useState } from "react"; import { InfoCircledIcon, PaperPlaneIcon, ReloadIcon, } from "@radix-ui/react-icons"; import { useMutation } from "@tanstack/react-query"; import { useCredentialGetter } from "@/hooks/useCredentialGetter"; import { getClient } from "@/api/AxiosClient"; import { AxiosError } from "axios"; import { toast } from "@/components/ui/use-toast"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; const examplePrompts = [ "What is the top post on hackernews?", "Navigate to Google Finance and search for AAPL", ]; const templateSamples: { [key in SampleCase]: { title: string; description: string; }; } = { blank: { title: "Blank", description: "Create task from a blank template", }, geico: { title: "Geico", description: "Generate an auto insurance quote", }, finditparts: { title: "Finditparts", description: "Find a product and add it to cart", }, california_edd: { title: "California_EDD", description: "Fill the employer services online enrollment form", }, bci_seguros: { title: "bci_seguros", description: "Generate an auto insurance quote", }, job_application: { title: "Job Application", description: "Fill a job application form", }, }; function TaskTemplates() { const navigate = useNavigate(); const [prompt, setPrompt] = useState(""); const credentialGetter = useCredentialGetter(); const getTaskFromPromptMutation = useMutation({ mutationFn: async (prompt: string) => { const client = await getClient(credentialGetter); return client .post("/generate/task", { prompt }) .then((response) => response.data); }, onSuccess: (response) => { navigate("/create/sk-prompt", { state: { data: response } }); }, onError: (error: AxiosError) => { toast({ variant: "destructive", title: "Error creating task from prompt", description: error.message, }); }, }); return (
Have a complicated workflow you would like to automate? Book a demo {"->"}

Try a prompt

We will generate a task for you automatically.