diff --git a/app/chat/page.tsx b/app/chat/page.tsx index 30038b3..a661f3e 100644 --- a/app/chat/page.tsx +++ b/app/chat/page.tsx @@ -12,6 +12,8 @@ import { Group, Text, Loader, + ActionIcon, + Tooltip, } from '@mantine/core'; import { useRef, useState, useEffect } from 'react'; import { MicrophoneRecorder } from '@/components/MicrophoneRecorder'; @@ -20,7 +22,7 @@ export default function ChatPage() { const viewport = useRef(null); const [input, setInput] = useState(''); - const { messages, sendMessage, isLoading, setMessages } = useChat({ + const { messages, sendMessage, setMessages, status } = useChat({ api: '/api/chat', body: { persona: 'Socratic', @@ -56,17 +58,44 @@ export default function ChatPage() { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - if (!input.trim() || isLoading) return; + if (!input.trim() || status === 'submitted' || status === 'streaming') return; sendMessage({ text: input }); setInput(''); }; + const handleNewConversation = () => { + // Clear all messages and reset to initial greeting + setMessages([ + { + id: 'initial-greeting', + role: 'assistant', + parts: [ + { + type: 'text', + text: 'Welcome to Ponderants! I\'m here to help you explore and structure your ideas through conversation.\n\nWhat would you like to talk about today? I can adapt my interview style to best suit your needs (Socratic questioning, collaborative brainstorming, or other approaches).\n\nJust start sharing your thoughts, and we\'ll discover meaningful insights together.', + }, + ], + }, + ]); + }; + return ( - - Ponderants Interview - + + + Ponderants Interview + + + + + {/* Microphone Recorder */} @@ -184,7 +213,11 @@ export default function ChatPage() { }} /> -