feat: Implement Anthropic AI Chatbot with Daily Rate Limiting#114
feat: Implement Anthropic AI Chatbot with Daily Rate Limiting#114kalyan-1845 wants to merge 11 commits into
Conversation
|
@kalyan-1845 is attempting to deploy a commit to the daviddprtma's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
delete this file as it is not necessarily to use pnpm anymore,
| import { Input } from '@/components/ui/input'; | ||
| import { ScrollArea } from '@/components/ui/scroll-area'; | ||
| import { useAuth } from '@/contexts/AuthContext'; | ||
| import { supabase } from '@/lib/supabaseClient'; |
There was a problem hiding this comment.
please delete this if you don't want to use it anymore
| @@ -0,0 +1,96 @@ | |||
| import { useState } from 'react'; | |||
| import { useChat } from 'ai/react'; | |||
|
Thank you for the feedback! I have deleted the \pnpm-lock.yaml\ file, removed the unused \supabase\ import, and ensured all dependencies are correctly installed using standard |
|
I'm so sorry about the confusion! I accidentally pushed those fixes to a different branch earlier and got my wires crossed. I have just pushed the correct commit to this branch! Here is exactly what was fixed:
Everything should be perfectly clean now. Thank you for your patience! |
| placeholder="Ask something..." | ||
| className="flex-1" | ||
| /> | ||
| <Button type="submit" size="icon" disabled={isLoading || !input.trim()}> |
|
Hi @daviddprtma! Just a gentle follow-up - I have pushed the fixes you requested (deleted pnpm-lock.yaml and resolved the ai/react import error). Would you be able to review this PR when you get a chance? Happy to make any further changes if needed. Thank you! |
- Removed @ai-sdk/react useChat hook which was causing errors on mount - Replaced with manual fetch that only calls the API when user submits a message - No error shown when clicking the chat icon anymore - Handles all response formats gracefully
|
Thank you for catching that! I found the root cause - the useChat hook from @ai-sdk/react was trying to establish a connection immediately when the chat widget opened, which caused the error before the user even typed anything. I have completely rewritten the ChatbotWidget to use a manual etch approach instead. Now:
The fix has been pushed! |
|
hello @kalyan-1845 there's a merge conflicts in this PR. please fix it so I can see your work. thanks. |






Fixes #15
Hi @daviddprtma! As discussed, here is the implementation for the AI Chatbot using Anthropic.
Changes Included:
ChatbotWidget.tsx(a floating chat interface built with Shadcn andlucide-react) and integrated it globally inApp.tsx.ai-chatSupabase Edge Function to securely call theclaude-3-haiku-20240307model and stream the response to the UI.chat_usagetable) that tracks message counts and successfully blocks users from exceeding 20,000 daily messages without needing third-party services like Redis.Let me know if you want any UI tweaks!