'use client'; import type { ChatStatus } from 'ai'; import { ChatInput, type PromptInputMessage } from './ChatInput'; import { Suggestion } from '@/components/ai-elements/suggestion'; import { RiOpenaiLine } from '@remixicon/react'; import { Shimmer } from '@/components/ai-elements/shimmer'; export interface PromptSuggestion { key: string; value: string; } interface ChatPromptProps { value: string; onChange: (value: string) => void; onSubmit: (message: PromptInputMessage) => void; status?: ChatStatus; suggestions?: PromptSuggestion[]; webSearchEnabled?: boolean; } const defaultSuggestions: PromptSuggestion[] = [ { key: 'Latest AI news', value: 'What are the latest developments in AI in 2026? Search for recent news.', }, { key: 'Research a company', value: 'Research OpenAI: their latest products, funding, and news.', }, { key: 'Fact check', value: 'What is the current population of the world and how is it changing?', }, { key: 'Compare topics', value: 'Compare the latest iPhone vs Samsung Galaxy flagship models with sources.', }, ]; const offlineSuggestions: PromptSuggestion[] = [ { key: 'Explain a concept', value: 'Explain retrieval-augmented generation in plain language.', }, { key: 'Compare approaches', value: 'Compare REST and GraphQL, including when to choose each.', }, { key: 'Draft an outline', value: 'Draft an outline for a practical guide to evaluating AI agents.', }, { key: 'Brainstorm ideas', value: 'Brainstorm useful AI agent ideas for a small business.', }, ]; export function ChatPrompt({ value, onChange, onSubmit, status = 'ready', suggestions, webSearchEnabled = false, }: ChatPromptProps) { const displayedSuggestions = suggestions ?? (webSearchEnabled ? defaultSuggestions : offlineSuggestions); const handleSuggestionClick = (suggestion: string) => { onChange(suggestion); }; return (
{webSearchEnabled ? "Ask anything — I'll search the web in real time to find accurate, up-to-date answers with sources." : 'Ask anything — I can help research, explain, compare, and summarize.'}