import { PlusIcon, Loader2 } from "lucide-react"; import { Button } from "../ui"; import { Textarea } from "../ui/textarea"; import { useState } from "react"; import { z } from "zod"; import { EpisodeType } from "@core/types"; import { useFetcher } from "@remix-run/react"; export const IngestBodyRequest = z.object({ episodeBody: z.string(), referenceTime: z.string(), type: z.enum([EpisodeType.Conversation, EpisodeType.Text]), // Assuming these are the EpisodeType values source: z.string(), spaceId: z.string().optional(), sessionId: z.string().optional(), }); export const Ingest = () => { const [text, setText] = useState(""); const fetcher = useFetcher(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); fetcher.submit( { episodeBody: text, type: "TEXT", referenceTime: new Date().toISOString(), source: "local", }, { method: "POST", action: "/home/dashboard" }, ); setText(""); }; const isLoading = fetcher.state === "submitting"; return (