-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Labels
ECWoC26bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Problem
Current chatbot (src/components/help-chatbot.tsx) only has 4 hardcoded Q&A responses. Users can't ask natural questions about platform features (ticket uploads, matching, dashboard).
Proposal
Add AI chatbot using Google Gemini 1.5 Flash (free tier)
Setup
npm install @google/generative-aiGet free API key: https://aistudio.google.com/app/apikey
(use your for testing purpose , later I'll update it )
# .env.local
GEMINI_API_KEY=your_key_hereImplementation
1. API Route (src/app/api/chat/route.ts)
- Validate input: type check, max 500 chars
- System prompt restricts to platform topics only
- Return
{ reply: string }or{ error: string } - No secrets/stack traces in responses
2. Update Component (src/components/help-chatbot.tsx)
- Replace hardcoded Q&A with API calls
- Message history state
- Loading states, auto-scroll
- ARIA labels, keyboard support
3. Security
- API key only in
.env.local(in.gitignore) - Input validation on client + server
- Sanitize errors
Acceptance Criteria
- Answers platform questions (tickets, matching, dashboard)
- Redirects off-topic questions
- No secrets committed
- Input validated (≤500 chars)
- Accessible (ARIA, keyboard nav)
- No TypeScript/ESLint errors
- Works locally with PostgreSQL
Gemini chosen: Free, simple setup, good enough quality ✅
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ECWoC26bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Projects
Status
Done