mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-10 08:48:29 +00:00
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { PlusIcon } 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";
|
|
|
|
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("");
|
|
|
|
return (
|
|
<div className="flex flex-col">
|
|
<form method="POST" action="/home/dashboard" className="flex flex-col">
|
|
<input type="hidden" name="type" value="TEXT" />
|
|
<input
|
|
type="hidden"
|
|
name="referenceTime"
|
|
value={new Date().toISOString()}
|
|
/>
|
|
<input type="hidden" name="source" value="local" />
|
|
|
|
<Textarea
|
|
name="episodeBody"
|
|
value={text}
|
|
placeholder="Tell what you want to add"
|
|
onChange={(e) => setText(e.target.value)}
|
|
/>
|
|
|
|
<div className="mt-2 flex justify-end">
|
|
<Button type="submit" variant="secondary" className="gap-1">
|
|
<PlusIcon size={16} />
|
|
Add
|
|
</Button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
);
|
|
};
|