"use client"; import { useRouter } from "next/navigation"; import { Input } from "@/components/ui/input"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import Link from "next/link"; import { Form, FormField, FormItem, FormMessage } from "@/components/ui/form"; import { Button } from "@/components/ui/button"; import { MagnifyingGlassIcon } from "@radix-ui/react-icons"; const formSchema = z.object({ query: z.string().optional(), }); function SearchForm() { const router = useRouter(); // Use the useRouter hook const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { query: "", }, }); async function onSubmit(values: z.infer) { const query = values.query; if (query) { router.push(`/search?query=${query}`); } } return ( <>
( )} />
); } export default function Page() { return (

Chat with your data

Built using Embedchain ❤️ Code available on{" "} GitHub .

); }