diff --git a/app/(chat)/layout.tsx b/app/(chat)/layout.tsx index 8ea30ecf77..f71b1b52d6 100644 --- a/app/(chat)/layout.tsx +++ b/app/(chat)/layout.tsx @@ -26,6 +26,33 @@ export default function Layout({ children }: { children: React.ReactNode }) { } async function SidebarShell({ children }: { children: React.ReactNode }) { + const isDbConfigured = Boolean(process.env.POSTGRES_URL); + + if (!isDbConfigured) { + return ( +
+
+
+ ⚠️ +

+ Database Connection Required +

+
+

+ This chatbot requires a database connection to persist conversation history and manage active sessions. +

+
+

To fix this, create a .env.local file in the root:

+
POSTGRES_URL="postgres://username:password@host:port/database"
+
+

+ Once you've configured your .env.local file, restart the development server. You can provision a free Postgres database using Neon, Vercel Postgres, or run a local instance via Docker. +

+
+
+ ); + } + const [session, cookieStore] = await Promise.all([auth(), cookies()]); const isCollapsed = cookieStore.get("sidebar_state")?.value !== "true"; diff --git a/components/chat/greeting.tsx b/components/chat/greeting.tsx index 9878bad75d..0f1af1a87d 100644 --- a/components/chat/greeting.tsx +++ b/components/chat/greeting.tsx @@ -1,24 +1,36 @@ import { motion } from "framer-motion"; +import { SparklesIcon } from "lucide-react"; export const Greeting = () => { return ( -
+
+ + + + What can I help with? - - + + - Ask a question, write code, or explore ideas. - + Ask a question, write and analyze code, or brainstorm ideas. +
); }; + diff --git a/components/chat/suggested-actions.tsx b/components/chat/suggested-actions.tsx index 5da7c29e9e..26cbf3a5c4 100644 --- a/components/chat/suggested-actions.tsx +++ b/components/chat/suggested-actions.tsx @@ -3,7 +3,12 @@ import type { UseChatHelpers } from "@ai-sdk/react"; import { motion } from "framer-motion"; import { memo } from "react"; -import { suggestions } from "@/lib/constants"; +import { + GlobeIcon, + Code2Icon, + BookOpenIcon, + CloudSunIcon +} from "lucide-react"; import type { ChatMessage } from "@/lib/types"; import { Suggestion } from "../ai-elements/suggestion"; import type { VisibilityType } from "./visibility-selector"; @@ -14,9 +19,34 @@ type SuggestedActionsProps = { selectedVisibilityType: VisibilityType; }; -function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) { - const suggestedActions = suggestions; +const curatedActions = [ + { + title: "Explain Next.js", + description: "Learn about Server Components & the App Router.", + prompt: "What are the advantages of using Next.js?", + icon: , + }, + { + title: "Dijkstra's Algorithm", + description: "Generate a clean implementation in Python.", + prompt: "Write code to demonstrate Dijkstra's algorithm", + icon: , + }, + { + title: "Silicon Valley Essay", + description: "Outline a historical analysis of technology hubs.", + prompt: "Help me write an essay about Silicon Valley", + icon: , + }, + { + title: "Weather in San Francisco", + description: "Check current meteorological conditions.", + prompt: "What is the weather in San Francisco?", + icon: , + }, +]; +function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) { return (
- {suggestedActions.map((suggestedAction, index) => ( + {curatedActions.map((action, index) => ( { window.history.pushState( {}, @@ -53,9 +83,19 @@ function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) { parts: [{ type: "text", text: suggestion }], }); }} - suggestion={suggestedAction} + suggestion={action.prompt} > - {suggestedAction} +
+ {action.icon} +
+
+ + {action.title} + + + {action.description} + +
))}