https://github.com/rishabh3562/sentiment-analysis-chatbot-js
A simple chatbot built with TypeScript and the Gemini API, utilizing sentiment analysis with an event-stream architecture.
https://github.com/rishabh3562/sentiment-analysis-chatbot-js
ai chatbot gemini-api sentiment-analysis typescript
Last synced: about 1 year ago
JSON representation
A simple chatbot built with TypeScript and the Gemini API, utilizing sentiment analysis with an event-stream architecture.
- Host: GitHub
- URL: https://github.com/rishabh3562/sentiment-analysis-chatbot-js
- Owner: rishabh3562
- License: mit
- Created: 2025-03-28T06:29:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T08:02:11.000Z (over 1 year ago)
- Last Synced: 2025-03-28T09:22:11.066Z (over 1 year ago)
- Topics: ai, chatbot, gemini-api, sentiment-analysis, typescript
- Language: TypeScript
- Homepage: https://sentiment-analysis-chatbot-js.vercel.app
- Size: 153 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Chatbot with TypeScript, Gemini API, and Sentiment Analysis
## Overview
This project is a simple chatbot built using **TypeScript** and the **Gemini API**, incorporating **sentiment analysis** with an **event-stream architecture** for real-time responses.
## Features
- **Real-time streaming responses** (similar to ChatGPT)
- **Sentiment analysis** for analyzing user input
- **TypeScript** for type safety and maintainability
- **Gemini API** integration for natural language understanding
- **Event-stream architecture** for efficient message handling
## Technologies Used
- **TypeScript**
- **Nextjs** (for frontend)
- **Gemini API** (for chatbot responses)
- **Sentiment Analysis Library** (e.g., `sentiment` or `compromise`)
- **Event Streams** (Server-Sent Events or WebSockets)
## Installation
### Prerequisites
- **Node.js** (v16 or later)
- **Gemini API Key**
### Steps
1. Clone the repository:
```sh
git clone https://github.com/rishabh3562/sentiment-analysis-chatbot-js.git
cd sentiment-analysis-chatbot-js
```
2. Install dependencies:
```sh
npm install
```
3. Create a `.env` file and add your API key:
```env
GEMINI_API_KEY=your_api_key_here
```
4. Start the server:
```sh
npm run dev
```
## Usage
- Run the server and send a POST request to `/chat` with user input.
- The chatbot will return a streaming response with sentiment analysis insights.
## API Endpoints
| Method | Endpoint | Description |
|--------|------------|-------------|
| POST | `/chat` | Sends a message and receives a streaming chatbot response |
## Example Request
```sh
curl -X POST http://localhost:3000/chat -H "Content-Type: application/json" -d '{"message": "Hello! How are you?"}'
```
## Future Enhancements
- WebSocket support for two-way communication
- UI integration with React
- Multi-language support
## License
This project is licensed under the MIT License.