From 91c68c0af438b668d97a877a265d2dbe6a5cf7c7 Mon Sep 17 00:00:00 2001 From: Bereket Engida <86073083+Bekacru@users.noreply.github.com> Date: Sat, 11 Oct 2025 20:33:23 -0700 Subject: [PATCH] docs: improve ai chat inbox ui (#5244) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/components/floating-ai-search.tsx | 125 ++++++++++++++----------- 1 file changed, 72 insertions(+), 53 deletions(-) diff --git a/docs/components/floating-ai-search.tsx b/docs/components/floating-ai-search.tsx index 0666fd37..2f1e5284 100644 --- a/docs/components/floating-ai-search.tsx +++ b/docs/components/floating-ai-search.tsx @@ -11,7 +11,7 @@ import { useRef, useState, } from "react"; -import { Loader2, SearchIcon, Send, X } from "lucide-react"; +import { Loader2, SearchIcon, Send, Trash2, X } from "lucide-react"; import { cn } from "@/lib/utils"; import { buttonVariants } from "fumadocs-ui/components/ui/button"; import Link from "fumadocs-core/link"; @@ -33,30 +33,30 @@ function useChatContext() { return use(Context)!.chat; } -function SearchAIActions() { - const { messages, status, setMessages, stop } = useChatContext(); - const isGenerating = status === "streaming" || status === "submitted"; +// function SearchAIActions() { +// const { messages, status, setMessages, stop } = useChatContext(); +// const isGenerating = status === "streaming" || status === "submitted"; - if (messages.length === 0) return null; +// if (messages.length === 0) return null; - return ( - <> - - > - ); -} +// return ( +// <> +// +// > +// ); +// } const suggestions = [ "How to configure Sqlite database?", @@ -66,7 +66,7 @@ const suggestions = [ ]; function SearchAIInput(props: ComponentProps<"form">) { - const { status, sendMessage, stop, messages } = useChatContext(); + const { status, sendMessage, stop, messages, setMessages } = useChatContext(); const [input, setInput] = useState(""); const isLoading = status === "streaming" || status === "submitted"; const showSuggestions = messages.length === 0 && !isLoading; @@ -81,12 +81,22 @@ function SearchAIInput(props: ComponentProps<"form">) { void sendMessage({ text: suggestion }); }; + const handleClear = () => { + setMessages([]); + setInput(""); + }; + useEffect(() => { if (isLoading) document.getElementById("nd-ai-input")?.focus(); }, [isLoading]); return ( -
Clear
+
- Powered by{" "}
-
-
- Powered by{" "}
-
-