diff --git a/src/app/(dashboard)/ai-assistant/page.tsx b/src/app/(dashboard)/ai-assistant/page.tsx index 5ec3bcf..2a30a5b 100644 --- a/src/app/(dashboard)/ai-assistant/page.tsx +++ b/src/app/(dashboard)/ai-assistant/page.tsx @@ -3,10 +3,19 @@ import { useState, useCallback, useRef } from "react" import { AIChat, type AIChatHandle } from "@/components/ai/ai-chat" import { JobSelector } from "@/components/ai/job-selector" -import { Bot } from "lucide-react" +import { Bot, ChevronRight } from "lucide-react" + +const tips = [ + "Ask for cold email templates for a specific job", + "Request objection handling tips", + "Ask for outreach strategies per industry", + "Generate a follow up sequence", + "Get LinkedIn connection message templates", +] export default function AIAssistantPage() { const [selectedJob, setSelectedJob] = useState<{ job_title: string; keywords: string[]; industry: string; description: string } | null>(null) + const [recentPrompts, setRecentPrompts] = useState([]) const [searching, setSearching] = useState(false) const aiChatRef = useRef(null) @@ -17,12 +26,12 @@ export default function AIAssistantPage() { const handleSearch = useCallback(async (job: NonNullable) => { setSearching(true) const keyword = job.keywords[0] - aiChatRef.current?.addAssistantMessage(`?? Searching Facebook for **${job.job_title}** leads...`) + aiChatRef.current?.addAssistantMessage(`🔍 Searching Facebook for **${job.job_title}** leads...`) const controller = new AbortController() const timeoutId = setTimeout(() => controller.abort(), 360000) const statusId = setTimeout(() => { - aiChatRef.current?.addAssistantMessage("? Still searching Facebook (this can take up to 5 minutes)...") + aiChatRef.current?.addAssistantMessage("⏳ Still searching Facebook (this can take up to 5 minutes)...") }, 45000) try { @@ -32,25 +41,40 @@ export default function AIAssistantPage() { const data = await res.json() if (data.success && data.leads?.length > 0) { const leadsText = data.leads.map((lead: any, i: number) => - `**${i + 1}.** ${lead.author || "Unknown"}\n> ${(lead.content || "").slice(0, 300)}\n> ?? ${lead.url || "(no link available)"}` + `**${i + 1}.** ${lead.author || "Unknown"}\n> ${(lead.content || "").slice(0, 300)}\n> 🔗 ${lead.url || "(no link available)"}` ).join("\n\n") - aiChatRef.current?.addAssistantMessage(`? Found **${data.leads.length}** leads:\n\n${leadsText}`) + aiChatRef.current?.addAssistantMessage(`✅ Found **${data.leads.length}** leads:\n\n${leadsText}`) } else { const reason = data.error || data.flag_reason || "No leads found this time" - aiChatRef.current?.addAssistantMessage(`?? ${reason}`) + aiChatRef.current?.addAssistantMessage(`⚠️ ${reason}`) } } catch (err: any) { clearTimeout(timeoutId) clearTimeout(statusId) const msg = err.name === "AbortError" - ? "? Scraper timed out after 5 minutes. Try again or check the scraper service." - : `? ${err instanceof Error ? err.message : "Search failed"}` + ? "❌ Scraper timed out after 5 minutes. Try again or check the scraper service." + : `❌ ${err instanceof Error ? err.message : "Search failed"}` aiChatRef.current?.addAssistantMessage(msg) } finally { setSearching(false) } }, []) + const handleTipClick = useCallback((tip: string) => { + aiChatRef.current?.fillInput(tip) + }, []) + + const handleRecentPromptClick = useCallback((prompt: string) => { + aiChatRef.current?.fillInput(prompt) + }, []) + + const handleMessageSent = useCallback((msg: string) => { + setRecentPrompts((prev) => { + const next = [msg, ...prev.filter((p) => p !== msg)].slice(0, 3) + return next + }) + }, []) + return (
@@ -77,7 +101,7 @@ export default function AIAssistantPage() {
- +
@@ -99,7 +123,54 @@ export default function AIAssistantPage() {
)}
+
+
+ + Quick Tips +
+ {tips.map((tip, i) => ( +
handleTipClick(tip)} + className="flex items-start gap-2.5 bg-card/50 hover:bg-card border border-border hover:border-primary/20 rounded-xl p-3.5 mb-2 cursor-pointer transition-all duration-200 group" + > + + {tip} +
+ ))} +
+
+
+ + Recent Prompts +
+ {recentPrompts.length > 0 ? ( + recentPrompts.map((prompt, i) => ( +
handleRecentPromptClick(prompt)} + className="bg-card/50 rounded-xl p-3 mb-2 border border-border text-muted-foreground text-xs truncate hover:text-foreground cursor-pointer transition-colors duration-200" + > + {prompt} +
+ )) + ) : ( +
Your recent prompts will appear here
+ )} +
+
+
+
+
Messages today
+
24
+
+
+
Tokens used
+
12.4k
+
+
+
) -} \ No newline at end of file +}