Site in active development
This site is still under active development. For now, you can read about the key features and properties of the Sahayak Chatbot below.
Sahayak Chatbot
An AI-powered customer support chatbot built on Next.js and Google Gemini, with retrieval-augmented generation (RAG), knowledge base management, and an embeddable widget for your website.
Technology Stack
- Framework: Next.js 16.1.1 (App Router) with React 19.2.3
- Language: TypeScript
- Database: PostgreSQL via Prisma ORM
- Authentication: Clerk
- UI: Shadcn & Radix UI components with Tailwind CSS
AI Model
Primary Model: Google Gemini 3 Flash Preview (gemini-3-flash-preview)
Temperature: 0.7 for conversational, helpful responses
Max Output Tokens: 1,000 tokens per reply
Context Limit: ~6,000 tokens (~24,000 characters)
Roughly, 4 characters ≈ 1 token in this app. Models process tokens, not words.
File Uploads & Web Scraping
- Max size: 10 MB per file
- Supported formats: CSV, TXT, PDF
- Content is summarized to under 2,000 words for storage in the knowledge base.
- Web pages are scraped using ZenRows, converted to markdown, then passed to Gemini to:
- Remove navigation, menus, CTAs, and ads
- Keep only factual, informational content
- Compress aggressively while preserving meaning
Sections & Tone Control
Sections let you configure different behaviors and scopes for your chatbot.
Tone Options
- Strict: fact-based, no small talk
- Neutral: professional and concise
- Friendly: warm and conversational
- Empathetic: support-first and calming
Scope Rules
- Allowed topics: restrict answers to e.g. “pricing, returns, shipping”
- Blocked topics: avoid e.g. “competitors, refunds”
Retrieval-Augmented Generation (RAG)
The chatbot uses Retrieval-Augmented Generation to answer questions from your own data.
1. Retrieval
Fetch relevant knowledge sources from the database: PDFs, website content, and text notes.
2. Augmentation
Inject that content into the prompt as context alongside system instructions and conversation history.
3. Generation
Gemini 3 Flash Preview generates a final answer from the augmented context, returning a concise, support-focused reply.
Product Features
- Knowledge base management (files, URLs, and raw text)
- Conversation history and session tracking
- Embeddable website widget with JWT-based sessions
- Configurable sections, tones, and topic scopes
- Customizable appearance and welcome messages
- Team management and role-based access (via Clerk)
Gemini Pricing Snapshot (2026)
- Input tokens: ≈ $0.50 per 1M tokens
- Output tokens: ≈ $3.00 per 1M tokens
- Audio input (if used): ≈ $1.00 per 1M tokens
Charges occur when the app calls the Gemini API for chat responses and for summarizing new knowledge sources (web pages, long text, and files).
End-to-End Chat Flow (High Level)
User Question │ ▼ [Retrieval] │ Fetch knowledge sources (PDFs, websites, text) ▼ [Augmentation] │ System Prompt + Context + Conversation History ▼ [Generation] │ Gemini 3 Flash Preview ▼ Assistant Answer