I see the issue - input is undefined because useChat with DefaultChatTransport doesn't return input or setInput. The AI SDK 6 with transport has a different API. Let me fix this by managing the input state locally and also rename the AI to "Disha":
Now let me also update the API route to reflect Disha's personality:
I've fixed the chatbot and renamed it to "Disha - Shows you your right path":
input and setInput were undefined from useChat when using DefaultChatTransport. I added local state management with useState("") to handle the input properly.I see two issues: 1) input is still undefined causing a crash, and 2) The Vercel AI Gateway requires credit card. Let me use Groq which has a free tier. First let me read and completely fix the chat widget:
The chat widget code looks correct with input initialized as useState(""). The issue is that the component is being rendered on the server side where useState doesn't work properly. The real problem is:
Let me use Groq which offers free API access without credit card. First, let me request the Groq API key and update the code:
Now let me update the API route to use Groq and fix the widget. First, request the Groq API key:
You can send messages while the preview loads