@undertheseanlp/chat
v0.1.0
Published
Chat application for AI Agent powered by Underthesea
Maintainers
Readme
Underthesea Chat
A chat application for AI Agent powered by Underthesea.
Installation
npm install @undertheseanlp/chatOr install globally:
npm install -g @undertheseanlp/chatEnvironment Variables
Set one of the following environment variable configurations:
OpenAI
export OPENAI_API_KEY=sk-...Azure OpenAI
export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=https://....openai.azure.comUsage
CLI
# Start the chat app
underthesea-chat
# With custom ports
underthesea-chat --backend-port 8002 --frontend-port 3001npm scripts
cd extensions/apps/chat
# Install all dependencies
npm install
# Development mode (with hot reload)
npm run dev
# Production mode
npm startThis starts:
- Frontend at http://localhost:3000
- Backend API at http://localhost:8001
API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /api/conversations | List all conversations |
| POST | /api/conversations | Create new conversation |
| GET | /api/conversations/{id} | Get conversation with messages |
| DELETE | /api/conversations/{id} | Delete conversation |
| POST | /api/conversations/{id}/chat | Send message, get AI response |
Architecture
chat/
├── bin/
│ └── cli.js # CLI entry point
├── backend/ # Express.js backend
│ ├── package.json
│ └── src/
│ ├── index.js # Express app
│ ├── database.js # SQLite setup
│ └── agent.js # OpenAI integration
└── frontend/ # Next.js frontend
└── src/
├── app/ # Next.js App Router
├── components/
├── lib/ # API client
└── types/