From b6d0cbd6720d6d4a42b25b1b168451e452f4a03c Mon Sep 17 00:00:00 2001 From: Albert Date: Sun, 9 Nov 2025 05:00:55 +0000 Subject: [PATCH] feat: Fix typing indicator and add New Conversation button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed typing indicator to use correct AI SDK status values (submitted/streaming) - Added "New Conversation" button to clear chat and start fresh - Updated all loading states to use status instead of undefined isLoading - Disabled input and send button while AI is responding The typing indicator now properly shows "AI Thinking..." while waiting for responses, and the New Conversation button allows users to reset the chat. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/chat/page.tsx | 49 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) 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() { }} /> -