gchat
v1.0.16
Published
gchat
Readme
gchat
A plug-and-play AI chat widget for React and Next.js, powered by Gemini. Just install, drop it into your app, and you have a full AI chat experience running in minutes.
Installation
- npm install gchat
Or with yarn
- yarn add gchat
📦 Usage
Put the chat component at the top level of your app (App.jsx or _app.js in Next.js).
function App() {
let prompt = "You're a good teacher, explain everything with examples";
return (
<GemChat
apiKey={process.env.GEMINI_API_KEY}
systemPrompt={prompt}
Memory={(chat) => {
// Save chat to DB, console, or do whatever you like
console.log(chat);
}}
/>
);
}
export default App;```
⚙️ Props
Prop Type Required Description
apiKey string ✅ Your Gemini API key (use env vars for safety).
systemPrompt string ✅ System-level instruction for the AI (sets tone & behavior).
Memory function ❌ Callback that receives chat history after each update.
🌐 Works With
React
Next.js
-> 📜 License
MIT